diff options
| author | Éric Araujo <merwok@netwok.org> | 2011-08-30 14:21:15 (GMT) |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2011-08-30 14:21:15 (GMT) |
| commit | d15b768ddb68fe82470d26bb2cc36699f4bc0b75 (patch) | |
| tree | 314bac1cdca839976e5de93505d7173add150826 /Lib/packaging/command | |
| parent | a514eb95f30306a11a14f8a3b9cbf229c6af6137 (diff) | |
| parent | b9fe54cccc3798f089489ef1e7f9026a35d16d6b (diff) | |
| download | cpython-d15b768ddb68fe82470d26bb2cc36699f4bc0b75.zip cpython-d15b768ddb68fe82470d26bb2cc36699f4bc0b75.tar.gz cpython-d15b768ddb68fe82470d26bb2cc36699f4bc0b75.tar.bz2 | |
Branch merge
Diffstat (limited to 'Lib/packaging/command')
| -rw-r--r-- | Lib/packaging/command/__init__.py | 10 | ||||
| -rw-r--r-- | Lib/packaging/command/bdist.py | 13 | ||||
| -rw-r--r-- | Lib/packaging/command/bdist_dumb.py | 20 | ||||
| -rw-r--r-- | Lib/packaging/command/bdist_msi.py | 6 | ||||
| -rw-r--r-- | Lib/packaging/command/bdist_wininst.py | 6 | ||||
| -rw-r--r-- | Lib/packaging/command/build_ext.py | 17 |
6 files changed, 39 insertions, 33 deletions
diff --git a/Lib/packaging/command/__init__.py b/Lib/packaging/command/__init__.py index 6a37850..2b52190 100644 --- a/Lib/packaging/command/__init__.py +++ b/Lib/packaging/command/__init__.py @@ -30,6 +30,8 @@ _COMMANDS = { 'upload': 'packaging.command.upload.upload', 'upload_docs': 'packaging.command.upload_docs.upload_docs'} +# XXX use OrderedDict to preserve the grouping (build-related, install-related, +# distribution-related) STANDARD_COMMANDS = set(_COMMANDS) @@ -48,9 +50,9 @@ def get_command_class(name): """Return the registered command""" try: cls = _COMMANDS[name] - if isinstance(cls, str): - cls = resolve_name(cls) - _COMMANDS[name] = cls - return cls except KeyError: raise PackagingModuleError("Invalid command %s" % name) + if isinstance(cls, str): + cls = resolve_name(cls) + _COMMANDS[name] = cls + return cls diff --git a/Lib/packaging/command/bdist.py b/Lib/packaging/command/bdist.py index e8c023d..b9d550b 100644 --- a/Lib/packaging/command/bdist.py +++ b/Lib/packaging/command/bdist.py @@ -64,20 +64,18 @@ class bdist(Command): 'os2': 'zip'} # Establish the preferred order (for the --help-formats option). - format_commands = ['gztar', 'bztar', 'ztar', 'tar', + format_commands = ['gztar', 'bztar', 'tar', 'wininst', 'zip', 'msi'] # And the real information. format_command = {'gztar': ('bdist_dumb', "gzip'ed tar file"), 'bztar': ('bdist_dumb', "bzip2'ed tar file"), - 'ztar': ('bdist_dumb', "compressed tar file"), 'tar': ('bdist_dumb', "tar file"), 'wininst': ('bdist_wininst', "Windows executable installer"), 'zip': ('bdist_dumb', "ZIP file"), - 'msi': ('bdist_msi', "Microsoft Installer") - } - + 'msi': ('bdist_msi', "Microsoft Installer"), + } def initialize_options(self): self.bdist_base = None @@ -109,8 +107,9 @@ class bdist(Command): try: self.formats = [self.default_format[os.name]] except KeyError: - raise PackagingPlatformError("don't know how to create built distributions " + \ - "on platform %s" % os.name) + raise PackagingPlatformError( + "don't know how to create built distributions " + "on platform %s" % os.name) if self.dist_dir is None: self.dist_dir = "dist" diff --git a/Lib/packaging/command/bdist_dumb.py b/Lib/packaging/command/bdist_dumb.py index f74b720..d5773f0 100644 --- a/Lib/packaging/command/bdist_dumb.py +++ b/Lib/packaging/command/bdist_dumb.py @@ -13,6 +13,7 @@ from packaging.command.cmd import Command from packaging.errors import PackagingPlatformError from packaging import logger + class bdist_dumb(Command): description = 'create a "dumb" built distribution' @@ -23,7 +24,7 @@ class bdist_dumb(Command): "platform name to embed in generated filenames " "(default: %s)" % get_platform()), ('format=', 'f', - "archive format to create (tar, ztar, gztar, zip)"), + "archive format to create (tar, gztar, zip)"), ('keep-temp', 'k', "keep the pseudo-installation tree around after " + "creating the distribution archive"), @@ -44,10 +45,9 @@ class bdist_dumb(Command): boolean_options = ['keep-temp', 'skip-build', 'relative'] - default_format = { 'posix': 'gztar', - 'nt': 'zip', - 'os2': 'zip' } - + default_format = {'posix': 'gztar', + 'nt': 'zip', + 'os2': 'zip'} def initialize_options(self): self.bdist_dir = None @@ -55,7 +55,7 @@ class bdist_dumb(Command): self.format = None self.keep_temp = False self.dist_dir = None - self.skip_build = False + self.skip_build = None self.relative = False self.owner = None self.group = None @@ -69,10 +69,12 @@ class bdist_dumb(Command): try: self.format = self.default_format[os.name] except KeyError: - raise PackagingPlatformError(("don't know how to create dumb built distributions " + - "on platform %s") % os.name) + raise PackagingPlatformError( + "don't know how to create dumb built distributions " + "on platform %s" % os.name) - self.set_undefined_options('bdist', 'dist_dir', 'plat_name') + self.set_undefined_options('bdist', + 'dist_dir', 'plat_name', 'skip_build') def run(self): if not self.skip_build: diff --git a/Lib/packaging/command/bdist_msi.py b/Lib/packaging/command/bdist_msi.py index 493f8b3..eaeb458 100644 --- a/Lib/packaging/command/bdist_msi.py +++ b/Lib/packaging/command/bdist_msi.py @@ -139,18 +139,22 @@ class bdist_msi(Command): self.no_target_optimize = False self.target_version = None self.dist_dir = None - self.skip_build = False + self.skip_build = None self.install_script = None self.pre_install_script = None self.versions = None def finalize_options(self): + self.set_undefined_options('bdist', 'skip_build') + if self.bdist_dir is None: bdist_base = self.get_finalized_command('bdist').bdist_base self.bdist_dir = os.path.join(bdist_base, 'msi') + short_version = get_python_version() if (not self.target_version) and self.distribution.has_ext_modules(): self.target_version = short_version + if self.target_version: self.versions = [self.target_version] if not self.skip_build and self.distribution.has_ext_modules()\ diff --git a/Lib/packaging/command/bdist_wininst.py b/Lib/packaging/command/bdist_wininst.py index dbb74ea..7dbb39b 100644 --- a/Lib/packaging/command/bdist_wininst.py +++ b/Lib/packaging/command/bdist_wininst.py @@ -67,13 +67,15 @@ class bdist_wininst(Command): self.dist_dir = None self.bitmap = None self.title = None - self.skip_build = False + self.skip_build = None self.install_script = None self.pre_install_script = None self.user_access_control = None def finalize_options(self): + self.set_undefined_options('bdist', 'skip_build') + if self.bdist_dir is None: if self.skip_build and self.plat_name: # If build is skipped and plat_name is overridden, bdist will @@ -83,8 +85,10 @@ class bdist_wininst(Command): # next the command will be initialized using that name bdist_base = self.get_finalized_command('bdist').bdist_base self.bdist_dir = os.path.join(bdist_base, 'wininst') + if not self.target_version: self.target_version = "" + if not self.skip_build and self.distribution.has_ext_modules(): short_version = get_python_version() if self.target_version and self.target_version != short_version: diff --git a/Lib/packaging/command/build_ext.py b/Lib/packaging/command/build_ext.py index b0c3f16..c16b116 100644 --- a/Lib/packaging/command/build_ext.py +++ b/Lib/packaging/command/build_ext.py @@ -606,8 +606,7 @@ class build_ext(Command): template = "python%d%d" if self.debug: template = template + '_d' - pythonlib = (template % - (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + pythonlib = template % sys.version_info[:2] # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib] @@ -621,22 +620,19 @@ class build_ext(Command): # not at this time - AIM Apr01 #if self.debug: # template = template + '_d' - pythonlib = (template % - (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + pythonlib = template % sys.version_info[:2] # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib] elif sys.platform[:6] == "cygwin": template = "python%d.%d" - pythonlib = (template % - (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + pythonlib = template % sys.version_info[:2] # don't extend ext.libraries, it may be shared with other # extensions, it is a reference to the original list return ext.libraries + [pythonlib] elif sys.platform[:6] == "atheos": template = "python%d.%d" - pythonlib = (template % - (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + pythonlib = template % sys.version_info[:2] # Get SHLIBS from Makefile extra = [] for lib in sysconfig.get_config_var('SHLIBS').split(): @@ -654,9 +650,8 @@ class build_ext(Command): else: if sysconfig.get_config_var('Py_ENABLE_SHARED'): - pythonlib = 'python{}.{}{}'.format( - sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, - sys.abiflags) + template = 'python%d%d' + sys.abiflags + pythonlib = template % sys.version_info[:2] return ext.libraries + [pythonlib] else: return ext.libraries |
