[Python-checkins] cpython (2.7): Fixes the 2.7 nuget packages to include a shim bdist_wininst

steve.dower python-checkins at python.org
Mon Dec 19 17:31:51 EST 2016


https://hg.python.org/cpython/rev/0391b6875319
changeset:   105754:0391b6875319
branch:      2.7
parent:      105749:fac2362f248c
user:        Steve Dower <steve.dower at microsoft.com>
date:        Mon Dec 19 14:31:27 2016 -0800
summary:
  Fixes the 2.7 nuget packages to include a shim bdist_wininst

files:
  Tools/nuget/distutils.command.bdist_wininst.py |  20 ++++++++++
  Tools/nuget/make_zip.py                        |  12 +++++-
  2 files changed, 30 insertions(+), 2 deletions(-)


diff --git a/Tools/nuget/distutils.command.bdist_wininst.py b/Tools/nuget/distutils.command.bdist_wininst.py
new file mode 100644
--- /dev/null
+++ b/Tools/nuget/distutils.command.bdist_wininst.py
@@ -0,0 +1,20 @@
+"""distutils.command.bdist_wininst
+
+Suppresses the 'bdist_wininst' command, while still allowing
+setuptools to import it without breaking."""
+
+from distutils.core import Command
+from distutils.errors import DistutilsPlatformError
+
+class bdist_wininst(Command):
+    description = "create an executable installer for MS Windows"
+
+    def initialize_options(self):
+        pass
+
+    def finalize_options(self):
+        pass
+
+    def run(self):
+        raise DistutilsPlatformError("bdist_wininst is not supported "
+            "in this Python distribution")
diff --git a/Tools/nuget/make_zip.py b/Tools/nuget/make_zip.py
--- a/Tools/nuget/make_zip.py
+++ b/Tools/nuget/make_zip.py
@@ -9,6 +9,7 @@
 import os
 import tempfile
 
+from itertools import chain
 from pathlib import Path
 from zipfile import ZipFile, ZIP_DEFLATED
 import subprocess
@@ -203,8 +204,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' / 'nuget' / 'distutils.command.bdist_wininst.py',
+                    Path('distutils') / 'command' / 'bdist_wininst.py'
+                ))
+            copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files))
             print('Copied {} files'.format(copied))
 
         if out:

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


More information about the Python-checkins mailing list