Issue #15822: Fix installation of lib2to3 grammar pickles to ensure

they are created in the install locations and with the proper timestamp.
(Solution suggested by MvL)
This commit is contained in:
Ned Deily 2012-09-08 19:04:47 -07:00
parent 2b0218a259
commit 24ec054ea1
3 changed files with 25 additions and 3 deletions

View file

@ -138,3 +138,20 @@ def _newer(a, b):
if not os.path.exists(b):
return True
return os.path.getmtime(a) >= os.path.getmtime(b)
def main(*args):
"""Main program, when run as a script: produce grammar pickle files.
Calls load_grammar for each argument, a path to a grammar text file.
"""
if not args:
args = sys.argv[1:]
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
format='%(message)s')
for gt in args:
load_grammar(gt, save=True, force=True)
return True
if __name__ == "__main__":
sys.exit(int(not main()))