}
EXCLUDE_FILE_FROM_LIBS = {
++ 'liblzma',
'ssleay',
'libeay',
'python3stub',
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--source', metavar='dir', help='The directory containing the repository root', type=Path)
- parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, default=None)
+ parser.add_argument('-o', '--out', metavar='file', help='The name of the output archive', type=Path, default=None)
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)
+ parser.add_argument('-a', '--arch', help='Specify the architecture to use (win32/amd64)', type=str, default="win32")
ns = parser.parse_args()
source = ns.source or (Path(__file__).resolve().parent.parent.parent)
try:
for t, s, p, c in layout:
- s = source / s.replace("$arch", arch)
- copied = copy_to_layout(temp / t.rstrip('/'), rglob(s, p, c))
- if s == '$build':
- fs = build
- else:
- fs = source / s
++ fs = source / s.replace("$arch", arch)
+ files = rglob(fs, p, c)
+ extra_files = []
+ if s == 'Lib' and p == '**/*':
+ extra_files.append((
+ source / 'tools' / 'msi' / 'distutils.command.__init__.py',
+ Path('distutils') / 'command' / '__init__.py'
+ ))
+ copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files))
print('Copied {} files'.format(copied))
- with open(str(temp / 'pyvenv.cfg'), 'w') as f:
- print('applocal = true', file=f)
+ if ns.embed:
+ with open(str(temp / (BASE_NAME + '._pth')), 'w') as f:
+ print(BASE_NAME + '.zip', file=f)
+ print('.', file=f)
+ print('', file=f)
+ print('# Uncomment to run site.main() automatically', file=f)
+ print('#import site', file=f)
if out:
total = copy_to_layout(out, rglob(temp, '**/*', None))