diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/command/bdist_dumb.py | 8 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_rpm.py | 13 | ||||
-rw-r--r-- | Lib/distutils/command/bdist_wininst.py | 6 | ||||
-rw-r--r-- | Lib/distutils/command/sdist.py | 2 | ||||
-rw-r--r-- | Lib/distutils/command/upload.py | 11 | ||||
-rw-r--r-- | Lib/distutils/dist.py | 12 |
6 files changed, 38 insertions, 14 deletions
diff --git a/Lib/distutils/command/bdist_dumb.py b/Lib/distutils/command/bdist_dumb.py index 5943551..ccba009 100644 --- a/Lib/distutils/command/bdist_dumb.py +++ b/Lib/distutils/command/bdist_dumb.py @@ -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) diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py index 09bfa43..c7b94e8 100644 --- a/Lib/distutils/command/bdist_rpm.py +++ b/Lib/distutils/command/bdist_rpm.py @@ -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() diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 5a83226..49afca0 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -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) diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 8b88f22..3dfe6f2 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -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 diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py index 6a4e3b3..266e9b1 100644 --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -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: diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index c7ec383..ff49886 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -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 |