Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Tools/msi/make_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def include_in_tools(p):
FULL_LAYOUT.append(('/', os.getenv('VCREDIST_PATH'), 'vcruntime*.dll', None))
EMBED_LAYOUT.append(('/', os.getenv('VCREDIST_PATH'), 'vcruntime*.dll', None))

def copy_to_layout(target, rel_sources):
def copy_to_layout(target, rel_sources, include_py=False):
count = 0

if target.suffix.lower() == '.zip':
Expand All @@ -149,6 +149,8 @@ def copy_to_layout(target, rel_sources):
except py_compile.PyCompileError:
f.write(str(s), str(rel))
else:
if include_py:
f.write(str(s), str(rel))
f.write(str(pyc), str(rel.with_suffix('.pyc')))
else:
f.write(str(s), str(rel))
Expand Down Expand Up @@ -188,6 +190,7 @@ def main():
parser.add_argument('-t', '--temp', metavar='dir', help='A directory to temporarily extract files into', type=Path, default=None)
parser.add_argument('-e', '--embed', help='Create an embedding layout', action='store_true', default=False)
parser.add_argument('-b', '--build', help='Specify the build directory', type=Path, default=None)
parser.add_argument('--include-py', help='Always include .py source files', action='store_true')
ns = parser.parse_args()

source = ns.source or (Path(__file__).resolve().parent.parent.parent)
Expand Down Expand Up @@ -229,7 +232,7 @@ def main():
source / 'tools' / 'msi' / 'distutils.command.bdist_wininst.py',
Path('distutils') / 'command' / 'bdist_wininst.py'
))
copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files))
copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files), include_py=ns.include_py)
print('Copied {} files'.format(copied))

if ns.embed:
Expand All @@ -241,7 +244,7 @@ def main():
print('#import site', file=f)

if out:
total = copy_to_layout(out, rglob(temp, '**/*', None))
total = copy_to_layout(out, rglob(temp, '**/*', None), include_py=ns.include_py)
print('Wrote {} files to {}'.format(total, out))
finally:
if delete_temp:
Expand Down