[Python-checkins] cpython (merge 3.5 -> 3.6): Issue #28783: Embedded and nuget packages incorrect reference missing

steve.dower python-checkins at python.org
Wed Nov 23 15:23:30 EST 2016


https://hg.python.org/cpython/rev/a3755890545c
changeset:   105347:a3755890545c
branch:      3.6
parent:      105340:749c5d6c4ba5
parent:      105346:f7aa200bed8d
user:        Steve Dower <steve.dower at microsoft.com>
date:        Wed Nov 23 11:42:35 2016 -0800
summary:
  Issue #28783: Embedded and nuget packages incorrect reference missing bdist_wininst command.

files:
  Tools/msi/distutils.command.__init__.py |  32 +++++++++++++
  Tools/msi/make_zip.py                   |  19 ++++++-
  2 files changed, 48 insertions(+), 3 deletions(-)


diff --git a/Tools/msi/distutils.command.__init__.py b/Tools/msi/distutils.command.__init__.py
new file mode 100644
--- /dev/null
+++ b/Tools/msi/distutils.command.__init__.py
@@ -0,0 +1,32 @@
+"""distutils.command
+
+Package containing implementation of all the standard Distutils
+commands."""
+
+__all__ = ['build',
+           'build_py',
+           'build_ext',
+           'build_clib',
+           'build_scripts',
+           'clean',
+           'install',
+           'install_lib',
+           'install_headers',
+           'install_scripts',
+           'install_data',
+           'sdist',
+           'register',
+           'bdist',
+           'bdist_dumb',
+           'bdist_rpm',
+           # This command is not included in this package
+           #'bdist_wininst',
+           'check',
+           'upload',
+           # These two are reserved for future use:
+           #'bdist_sdux',
+           #'bdist_pkgtool',
+           # Note:
+           # bdist_packager is not included because it only provides
+           # an abstract base class
+          ]
diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py
--- a/Tools/msi/make_zip.py
+++ b/Tools/msi/make_zip.py
@@ -7,6 +7,7 @@
 import os
 import tempfile
 
+from itertools import chain
 from pathlib import Path
 from zipfile import ZipFile, ZIP_DEFLATED
 import subprocess
@@ -42,6 +43,7 @@
 }
 
 EXCLUDE_FILE_FROM_LIBS = {
+    'liblzma',
     'ssleay',
     'libeay',
     'python3stub',
@@ -77,6 +79,10 @@
     if name in EXCLUDE_FILE_FROM_LIBRARY:
         return False
 
+    # Special code is included below to patch this file back in
+    if [d.lower() for d in p.parts[-3:]] == ['distutils', 'command', '__init__.py']:
+        return False
+
     suffix = p.suffix.lower()
     return suffix not in {'.pyc', '.pyo', '.exe'}
 
@@ -173,7 +179,7 @@
 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('-a', '--arch', help='Specify the architecture to use (win32/amd64)', type=str, default="win32")
@@ -207,8 +213,15 @@
 
     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))
+            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))
 
         if ns.embed:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list