summaryrefslogtreecommitdiff
path: root/Tools/msi/make_zip.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/msi/make_zip.py')
-rw-r--r--Tools/msi/make_zip.py54
1 files changed, 31 insertions, 23 deletions
diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py
index 6a03cbef0d..710e4a5c23 100644
--- a/Tools/msi/make_zip.py
+++ b/Tools/msi/make_zip.py
@@ -20,6 +20,7 @@ DEBUG_FILES = {
'_ctypes_test',
'_testbuffer',
'_testcapi',
+ '_testconsole',
'_testimportmultiple',
'_testmultiphase',
'xxlimited',
@@ -45,11 +46,16 @@ EXCLUDE_FILE_FROM_LIBRARY = {
}
EXCLUDE_FILE_FROM_LIBS = {
+ 'liblzma',
'ssleay',
'libeay',
'python3stub',
}
+EXCLUDED_FILES = {
+ 'pyshellext',
+}
+
def is_not_debug(p):
if DEBUG_RE.search(p.name):
return False
@@ -57,7 +63,7 @@ def is_not_debug(p):
if TKTCL_RE.search(p.name):
return False
- return p.stem.lower() not in DEBUG_FILES
+ return p.stem.lower() not in DEBUG_FILES and p.stem.lower() not in EXCLUDED_FILES
def is_not_debug_or_python(p):
return is_not_debug(p) and not PYTHON_DLL_RE.search(p.name)
@@ -67,8 +73,6 @@ def include_in_lib(p):
if p.is_dir():
if name in EXCLUDE_FROM_LIBRARY:
return False
- if name.startswith('plat-'):
- return False
if name == 'test' and p.parts[-2].lower() == 'lib':
return False
if name in {'test', 'tests'} and p.parts[-3].lower() == 'lib':
@@ -99,25 +103,27 @@ def include_in_tools(p):
return p.suffix.lower() in {'.py', '.pyw', '.txt'}
+BASE_NAME = 'python{0.major}{0.minor}'.format(sys.version_info)
+
FULL_LAYOUT = [
- ('/', '$build', 'python.exe', is_not_debug),
- ('/', '$build', 'pythonw.exe', is_not_debug),
- ('/', '$build', 'python{0.major}.dll'.format(sys.version_info), is_not_debug),
- ('/', '$build', 'python{0.major}{0.minor}.dll'.format(sys.version_info), is_not_debug),
- ('DLLs/', '$build', '*.pyd', is_not_debug),
- ('DLLs/', '$build', '*.dll', is_not_debug_or_python),
+ ('/', 'PCBuild/$arch', 'python.exe', is_not_debug),
+ ('/', 'PCBuild/$arch', 'pythonw.exe', is_not_debug),
+ ('/', 'PCBuild/$arch', 'python{}.dll'.format(sys.version_info.major), is_not_debug),
+ ('/', 'PCBuild/$arch', '{}.dll'.format(BASE_NAME), is_not_debug),
+ ('DLLs/', 'PCBuild/$arch', '*.pyd', is_not_debug),
+ ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug_or_python),
('include/', 'include', '*.h', None),
('include/', 'PC', 'pyconfig.h', None),
('Lib/', 'Lib', '**/*', include_in_lib),
- ('libs/', '$build', '*.lib', include_in_libs),
+ ('libs/', 'PCBuild/$arch', '*.lib', include_in_libs),
('Tools/', 'Tools', '**/*', include_in_tools),
]
EMBED_LAYOUT = [
- ('/', '$build', 'python*.exe', is_not_debug),
- ('/', '$build', '*.pyd', is_not_debug),
- ('/', '$build', '*.dll', is_not_debug),
- ('python{0.major}{0.minor}.zip'.format(sys.version_info), 'Lib', '**/*', include_in_embeddable_lib),
+ ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug),
+ ('/', 'PCBuild/$arch', '*.pyd', is_not_debug),
+ ('/', 'PCBuild/$arch', '*.dll', is_not_debug),
+ ('{}.zip'.format(BASE_NAME), 'Lib', '**/*', include_in_embeddable_lib),
]
if os.getenv('DOC_FILENAME'):
@@ -181,15 +187,15 @@ def main():
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)
out = ns.out
- build = ns.build
+ arch = ns.arch
assert isinstance(source, Path)
assert not out or isinstance(out, Path)
- assert isinstance(build, Path)
+ assert isinstance(arch, str)
if ns.temp:
temp = ns.temp
@@ -212,10 +218,7 @@ def main():
try:
for t, s, p, c in layout:
- 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 == '**/*':
@@ -226,8 +229,13 @@ def main():
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))