Commit fefebe03 authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 0.7.4

parent 616fbf55
Metadata-Version: 1.0
Name: rply
Version: 0.7.3
Version: 0.7.4
Summary: A pure Python Lex/Yacc that works with RPython
Home-page: UNKNOWN
Author: Alex Gaynor
......@@ -10,7 +10,7 @@ Description: RPLY
====
.. image:: https://secure.travis-ci.org/alex/rply.png
:target: http://travis-ci.org/alex/rply
:target: https://travis-ci.org/alex/rply
Welcome to RPLY! A pure python parser generator, that also works with RPython.
It is a more-or-less direct port of David Beazley's awesome PLY, with a new
......
......@@ -2,7 +2,7 @@ RPLY
====
.. image:: https://secure.travis-ci.org/alex/rply.png
:target: http://travis-ci.org/alex/rply
:target: https://travis-ci.org/alex/rply
Welcome to RPLY! A pure python parser generator, that also works with RPython.
It is a more-or-less direct port of David Beazley's awesome PLY, with a new
......
Metadata-Version: 1.0
Name: rply
Version: 0.7.3
Version: 0.7.4
Summary: A pure Python Lex/Yacc that works with RPython
Home-page: UNKNOWN
Author: Alex Gaynor
......@@ -10,7 +10,7 @@ Description: RPLY
====
.. image:: https://secure.travis-ci.org/alex/rply.png
:target: http://travis-ci.org/alex/rply
:target: https://travis-ci.org/alex/rply
Welcome to RPLY! A pure python parser generator, that also works with RPython.
It is a more-or-less direct port of David Beazley's awesome PLY, with a new
......
......@@ -15,4 +15,5 @@ rply/utils.py
rply.egg-info/PKG-INFO
rply.egg-info/SOURCES.txt
rply.egg-info/dependency_links.txt
rply.egg-info/requires.txt
rply.egg-info/top_level.txt
\ No newline at end of file
......@@ -2,12 +2,12 @@ import hashlib
import json
import os
import random
import stat
import string
import sys
import tempfile
import warnings
from appdirs import AppDirs
from rply.errors import ParserGeneratorError, ParserGeneratorWarning
from rply.grammar import Grammar
from rply.parser import LRParser
......@@ -175,44 +175,28 @@ class ParserGenerator(object):
g.compute_first()
g.compute_follow()
# win32 temp directories are already per-user
if os.name == "nt":
cache_file = os.path.join(
tempfile.gettempdir(),
"rply-%s-%s-%s.json" % (
self.VERSION, self.cache_id, self.compute_grammar_hash(g)
)
)
else:
cache_file = os.path.join(
tempfile.gettempdir(),
"rply-%s-%s-%s-%s.json" % (
self.VERSION,
os.getuid(),
self.cache_id,
self.compute_grammar_hash(g)
)
cache_dir = AppDirs("rply").user_cache_dir
cache_file = os.path.join(
cache_dir,
"%s-%s-%s.json" % (
self.cache_id, self.VERSION, self.compute_grammar_hash(g)
)
)
table = None
if os.path.exists(cache_file):
with open(cache_file) as f:
data = json.load(f)
stat_result = os.fstat(f.fileno())
if (
os.name == "nt" or (
stat_result.st_uid == os.getuid() and
stat.S_IMODE(stat_result.st_mode) == 0o0600
)
):
if self.data_is_valid(g, data):
table = LRTable.from_cache(g, data)
if self.data_is_valid(g, data):
table = LRTable.from_cache(g, data)
if table is None:
table = LRTable.from_grammar(g)
fd = os.open(
cache_file, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o0600
)
with os.fdopen(fd, "w") as f:
if not os.path.exists(cache_dir):
os.makedirs(cache_dir, mode=0o0700)
with open(cache_file, "w") as f:
json.dump(self.serialize_table(table), f)
if table.sr_conflicts:
warnings.warn(
"%d shift/reduce conflict%s" % (
......
......@@ -9,8 +9,9 @@ setup(
description="A pure Python Lex/Yacc that works with RPython",
long_description=readme,
# duplicated in docs/conf.py
version="0.7.3",
version="0.7.4",
author="Alex Gaynor",
author_email="alex.gaynor@gmail.com",
packages=["rply"],
install_requires=["appdirs"],
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment