mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
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:
parent
2b0218a259
commit
24ec054ea1
3 changed files with 25 additions and 3 deletions
|
|
@ -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()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue