preprocess_frozen_modules.py: make compatible with Python 3.4.

This commit is contained in:
Dan Halbert 2017-12-24 13:49:58 -05:00
parent 2dcb2f06cb
commit 644ad74ea1
1 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,9 @@ def copy_and_process(in_dir, out_dir):
output_file_path = Path(out_dir, input_file_path.relative_to(in_dir))
if file.endswith(".py"):
output_file_path.parent.mkdir(parents=True, exist_ok=True)
# mkdir() takes an exists_ok=True, but not until Python 3.5.
if not output_file_path.parent.exists():
output_file_path.parent.mkdir(parents=True)
with input_file_path.open("r") as input, output_file_path.open("w") as output:
for line in input:
if line.startswith("__version__"):