]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Make dist_files a triple, with the Python target version included,
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 23 Mar 2005 18:54:36 +0000 (18:54 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 23 Mar 2005 18:54:36 +0000 (18:54 +0000)
so that bdist_wininst can specify 'any'.

Lib/distutils/command/bdist_dumb.py
Lib/distutils/command/bdist_rpm.py
Lib/distutils/command/bdist_wininst.py
Lib/distutils/command/sdist.py
Lib/distutils/command/upload.py
Lib/distutils/dist.py

index 59435516fa507751a765ec8f6d3fb57afec35de7..ccba00955ac1a241920aab414d2e8e65724e8151 100644 (file)
@@ -13,6 +13,7 @@ from distutils.core import Command
 from distutils.util import get_platform
 from distutils.dir_util import create_tree, remove_tree, ensure_relative
 from distutils.errors import *
+from distutils.sysconfig import get_python_version
 from distutils import log
 
 class bdist_dumb (Command):
@@ -119,7 +120,12 @@ class bdist_dumb (Command):
         # Make the archive
         filename = self.make_archive(pseudoinstall_root,
                                      self.format, root_dir=archive_root)
-        self.distribution.dist_files.append(('bdist_dumb', filename))
+        if self.distribution.has_ext_modules():
+            pyversion = get_python_version()
+        else:
+            pyversion = 'any'
+        self.distribution.dist_files.append(('bdist_dumb', pyversion,
+                                             filename))
 
         if not self.keep_temp:
             remove_tree(self.bdist_dir, dry_run=self.dry_run)
index 09bfa43fd0426103083cad284eafe8f2673e0e08..c7b94e8133ff9db1076240fbbc799dc393827351 100644 (file)
@@ -15,6 +15,7 @@ from distutils.debug import DEBUG
 from distutils.util import get_platform
 from distutils.file_util import write_file
 from distutils.errors import *
+from distutils.sysconfig import get_python_version
 from distutils import log
 
 class bdist_rpm (Command):
@@ -346,6 +347,10 @@ class bdist_rpm (Command):
                 srpms = glob.glob(os.path.join(rpm_dir['SRPMS'], "*.rpm"))
                 assert len(srpms) == 1, \
                        "unexpected number of SRPM files found: %s" % srpms
+                dist_file = ('bdist_rpm', '',
+                             os.path.join(self.dist_dir,
+                                          os.path.basename(srpms[0])))
+                self.distribution.dist_files.append(dist_file)
                 self.move_file(srpms[0], self.dist_dir)
 
             if not self.source_only:
@@ -356,9 +361,15 @@ class bdist_rpm (Command):
                     rpms.remove(debuginfo[0])
                 assert len(rpms) == 1, \
                        "unexpected number of RPM files found: %s" % rpms
+                dist_file = ('bdist_rpm', get_python_version(),
+                             os.path.join(self.dist_dir,
+                                          os.path.basename(rpms[0])))
+                self.distribution.dist_files.append(dist_file)
                 self.move_file(rpms[0], self.dist_dir)
-                self.distribution.dist_files.append(('bdist_rpm', rpms[0]))
                 if debuginfo:
+                    dist_file = ('bdist_rpm', get_python_version(),
+                                 os.path.join(self.dist_dir,
+                                              os.path.basename(debuginfo[0])))
                     self.move_file(debuginfo[0], self.dist_dir)
     # run()
 
index 5a83226b7897940a4cd29fbf70e034ad04d3d3d6..49afca0472ae7b8b98478d9c81e8105ffe4f408e 100644 (file)
@@ -162,7 +162,11 @@ class bdist_wininst (Command):
                                     root_dir=self.bdist_dir)
         # create an exe containing the zip-file
         self.create_exe(arcname, fullname, self.bitmap)
-        self.distribution.dist_files.append(('bdist_wininst', 
+        if self.distribution.has_ext_modules():
+            pyversion = get_python_version()
+        else:
+            pyversion = 'any'
+        self.distribution.dist_files.append(('bdist_wininst', pyversion,
                                              self.get_installer_filename(fullname)))
         # remove the zip-file again
         log.debug("removing temporary file '%s'", arcname)
index 8b88f22f835bdb2913ed508680f10b56c4789794..3dfe6f21a7bb8a38d32790f4fbda8565fd52891a 100644 (file)
@@ -449,7 +449,7 @@ class sdist (Command):
         for fmt in self.formats:
             file = self.make_archive(base_name, fmt, base_dir=base_dir)
             archive_files.append(file)
-            self.distribution.dist_files.append(('sdist',file))
+            self.distribution.dist_files.append(('sdist', '', file))
 
         self.archive_files = archive_files
 
index 6a4e3b3332313c8d95efd380f0e476b99e7b81ea..266e9b1e8747c48ea04eb303c90ad3ae5391b6da 100644 (file)
@@ -4,7 +4,6 @@ Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
 
 from distutils.errors import *
 from distutils.core import Command
-from distutils.sysconfig import get_python_version
 from distutils.spawn import spawn
 from distutils import log
 from md5 import md5
@@ -61,10 +60,10 @@ class upload(Command):
     def run(self):
         if not self.distribution.dist_files:
             raise DistutilsOptionError("No dist file created in earlier command")
-        for command, filename in self.distribution.dist_files:
-            self.upload_file(command, filename)
+        for command, pyversion, filename in self.distribution.dist_files:
+            self.upload_file(command, pyversion, filename)
 
-    def upload_file(self, command, filename):
+    def upload_file(self, command, pyversion, filename):
         # Sign if requested
         if self.sign:
             spawn(("gpg", "--detach-sign", "-a", filename),
@@ -79,7 +78,7 @@ class upload(Command):
             'version':self.distribution.get_version(),
             'content':(os.path.basename(filename),content),
             'filetype':command,
-            'pyversion':get_python_version(),
+            'pyversion':pyversion,
             'md5_digest':md5(content).hexdigest(),
             }
         comment = ''
@@ -89,8 +88,6 @@ class upload(Command):
                 comment = 'built for %s %s' % (dist, version)
         elif command == 'bdist_dumb':
             comment = 'built for %s' % platform.platform(terse=1)
-        elif command == 'sdist':
-            data['pyversion'] = ''
         data['comment'] = comment
 
         if self.sign:
index c7ec3830facf208f846408e19bf0ed4397f8e704..ff49886d97fabdfa2afa67a023ddb6322af89fb9 100644 (file)
@@ -177,9 +177,15 @@ Common commands: (see '--help-commands' for more)
         #   command_options = { command_name : { option : (source, value) } }
         self.command_options = {}
 
-        # 'dist_files' is the list of (command, file) that have been created
-        # by any dist commands run so far. This is filled regardless
-        # of whether the run is dry or not.
+        # 'dist_files' is the list of (command, pyversion, file) that
+        # have been created by any dist commands run so far. This is
+        # filled regardless of whether the run is dry or not. pyversion
+        # gives sysconfig.get_python_version() if the dist file is
+        # specific to a Python version, 'any' if it is good for all
+        # Python versions on the target platform, and '' for a source
+        # file. pyversion should not be used to specify minimum or
+        # maximum required Python versions; use the metainfo for that
+        # instead.
         self.dist_files = []
 
         # These options are really the business of various commands, rather