aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/distutils
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Lib/distutils
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/distutils')
-rw-r--r--contrib/tools/python3/src/Lib/distutils/_msvccompiler.py32
-rw-r--r--contrib/tools/python3/src/Lib/distutils/archive_util.py22
-rw-r--r--contrib/tools/python3/src/Lib/distutils/bcppcompiler.py4
-rw-r--r--contrib/tools/python3/src/Lib/distutils/ccompiler.py10
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/bdist_msi.py42
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/bdist_rpm.py6
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/bdist_wininst.py98
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/build.py2
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/build_ext.py78
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/build_py.py6
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/check.py20
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/config.py34
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/install.py8
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/sdist.py14
-rw-r--r--contrib/tools/python3/src/Lib/distutils/command/upload.py56
-rw-r--r--contrib/tools/python3/src/Lib/distutils/msvc9compiler.py4
-rw-r--r--contrib/tools/python3/src/Lib/distutils/msvccompiler.py2
-rw-r--r--contrib/tools/python3/src/Lib/distutils/spawn.py132
-rw-r--r--contrib/tools/python3/src/Lib/distutils/sysconfig.py38
-rw-r--r--contrib/tools/python3/src/Lib/distutils/unixccompiler.py8
-rw-r--r--contrib/tools/python3/src/Lib/distutils/util.py70
-rw-r--r--contrib/tools/python3/src/Lib/distutils/version.py8
22 files changed, 347 insertions, 347 deletions
diff --git a/contrib/tools/python3/src/Lib/distutils/_msvccompiler.py b/contrib/tools/python3/src/Lib/distutils/_msvccompiler.py
index af8099a407..24bc487321 100644
--- a/contrib/tools/python3/src/Lib/distutils/_msvccompiler.py
+++ b/contrib/tools/python3/src/Lib/distutils/_msvccompiler.py
@@ -85,15 +85,15 @@ def _find_vc2017():
return None, None
-PLAT_SPEC_TO_RUNTIME = {
- 'x86' : 'x86',
- 'x86_amd64' : 'x64',
- 'x86_arm' : 'arm',
- 'x86_arm64' : 'arm64'
-}
-
+PLAT_SPEC_TO_RUNTIME = {
+ 'x86' : 'x86',
+ 'x86_amd64' : 'x64',
+ 'x86_arm' : 'arm',
+ 'x86_arm64' : 'arm64'
+}
+
def _find_vcvarsall(plat_spec):
- # bpo-38597: Removed vcruntime return value
+ # bpo-38597: Removed vcruntime return value
_, best_dir = _find_vc2017()
if not best_dir:
@@ -108,7 +108,7 @@ def _find_vcvarsall(plat_spec):
log.debug("%s cannot be found", vcvarsall)
return None, None
- return vcvarsall, None
+ return vcvarsall, None
def _get_vc_env(plat_spec):
if os.getenv("DISTUTILS_USE_SDK"):
@@ -117,7 +117,7 @@ def _get_vc_env(plat_spec):
for key, value in os.environ.items()
}
- vcvarsall, _ = _find_vcvarsall(plat_spec)
+ vcvarsall, _ = _find_vcvarsall(plat_spec)
if not vcvarsall:
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
@@ -163,8 +163,8 @@ def _find_exe(exe, paths=None):
PLAT_TO_VCVARS = {
'win32' : 'x86',
'win-amd64' : 'x86_amd64',
- 'win-arm32' : 'x86_arm',
- 'win-arm64' : 'x86_arm64'
+ 'win-arm32' : 'x86_arm',
+ 'win-arm64' : 'x86_arm64'
}
class MSVCCompiler(CCompiler) :
@@ -240,11 +240,11 @@ class MSVCCompiler(CCompiler) :
self.add_library_dir(dir.rstrip(os.sep))
self.preprocess_options = None
- # bpo-38597: Always compile with dynamic linking
- # Future releases of Python 3.x will include all past
- # versions of vcruntime*.dll for compatibility.
+ # bpo-38597: Always compile with dynamic linking
+ # Future releases of Python 3.x will include all past
+ # versions of vcruntime*.dll for compatibility.
self.compile_options = [
- '/nologo', '/Ox', '/W3', '/GL', '/DNDEBUG', '/MD'
+ '/nologo', '/Ox', '/W3', '/GL', '/DNDEBUG', '/MD'
]
self.compile_options_debug = [
diff --git a/contrib/tools/python3/src/Lib/distutils/archive_util.py b/contrib/tools/python3/src/Lib/distutils/archive_util.py
index 565a3117b4..3c711a085d 100644
--- a/contrib/tools/python3/src/Lib/distutils/archive_util.py
+++ b/contrib/tools/python3/src/Lib/distutils/archive_util.py
@@ -166,21 +166,21 @@ def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):
zip = zipfile.ZipFile(zip_filename, "w",
compression=zipfile.ZIP_STORED)
- with zip:
- if base_dir != os.curdir:
- path = os.path.normpath(os.path.join(base_dir, ''))
+ with zip:
+ if base_dir != os.curdir:
+ path = os.path.normpath(os.path.join(base_dir, ''))
zip.write(path, path)
log.info("adding '%s'", path)
- for dirpath, dirnames, filenames in os.walk(base_dir):
- for name in dirnames:
- path = os.path.normpath(os.path.join(dirpath, name, ''))
+ for dirpath, dirnames, filenames in os.walk(base_dir):
+ for name in dirnames:
+ path = os.path.normpath(os.path.join(dirpath, name, ''))
zip.write(path, path)
log.info("adding '%s'", path)
- for name in filenames:
- path = os.path.normpath(os.path.join(dirpath, name))
- if os.path.isfile(path):
- zip.write(path, path)
- log.info("adding '%s'", path)
+ for name in filenames:
+ path = os.path.normpath(os.path.join(dirpath, name))
+ if os.path.isfile(path):
+ zip.write(path, path)
+ log.info("adding '%s'", path)
return zip_filename
diff --git a/contrib/tools/python3/src/Lib/distutils/bcppcompiler.py b/contrib/tools/python3/src/Lib/distutils/bcppcompiler.py
index 071fea5d03..d0603271ff 100644
--- a/contrib/tools/python3/src/Lib/distutils/bcppcompiler.py
+++ b/contrib/tools/python3/src/Lib/distutils/bcppcompiler.py
@@ -14,10 +14,10 @@ for the Borland C++ compiler.
import os
from distutils.errors import \
- DistutilsExecError, \
+ DistutilsExecError, \
CompileError, LibError, LinkError, UnknownFileError
from distutils.ccompiler import \
- CCompiler, gen_preprocess_options
+ CCompiler, gen_preprocess_options
from distutils.file_util import write_file
from distutils.dep_util import newer
from distutils import log
diff --git a/contrib/tools/python3/src/Lib/distutils/ccompiler.py b/contrib/tools/python3/src/Lib/distutils/ccompiler.py
index 4c47f2ed24..3c8c35f0a8 100644
--- a/contrib/tools/python3/src/Lib/distutils/ccompiler.py
+++ b/contrib/tools/python3/src/Lib/distutils/ccompiler.py
@@ -8,7 +8,7 @@ from distutils.errors import *
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
-from distutils.dep_util import newer_group
+from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute
from distutils import log
@@ -392,7 +392,7 @@ class CCompiler:
return output_dir, macros, include_dirs
def _prep_compile(self, sources, output_dir, depends=None):
- """Decide which source files must be recompiled.
+ """Decide which source files must be recompiled.
Determine the list of object files corresponding to 'sources',
and figure out which ones really need to be recompiled.
@@ -545,7 +545,7 @@ class CCompiler:
'extra_preargs' and 'extra_postargs' are implementation- dependent.
On platforms that have the notion of a command-line (e.g. Unix,
DOS/Windows), they are most likely lists of strings: extra
- command-line arguments to prepend/append to the compiler command
+ command-line arguments to prepend/append to the compiler command
line. On other platforms, consult the implementation class
documentation. In any event, they are intended as an escape hatch
for those occasions when the abstract compiler framework doesn't
@@ -781,9 +781,9 @@ class CCompiler:
for incl in includes:
f.write("""#include "%s"\n""" % incl)
f.write("""\
-int main (int argc, char **argv) {
+int main (int argc, char **argv) {
%s();
- return 0;
+ return 0;
}
""" % funcname)
finally:
diff --git a/contrib/tools/python3/src/Lib/distutils/command/bdist_msi.py b/contrib/tools/python3/src/Lib/distutils/command/bdist_msi.py
index 0863a1883e..8ab133e18e 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/bdist_msi.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/bdist_msi.py
@@ -6,9 +6,9 @@
Implements the bdist_msi command.
"""
-import os
-import sys
-import warnings
+import os
+import sys
+import warnings
from distutils.core import Command
from distutils.dir_util import remove_tree
from distutils.sysconfig import get_python_version
@@ -124,12 +124,12 @@ class bdist_msi(Command):
'3.5', '3.6', '3.7', '3.8', '3.9']
other_version = 'X'
- def __init__(self, *args, **kw):
- super().__init__(*args, **kw)
- warnings.warn("bdist_msi command is deprecated since Python 3.9, "
- "use bdist_wheel (wheel packages) instead",
- DeprecationWarning, 2)
-
+ def __init__(self, *args, **kw):
+ super().__init__(*args, **kw)
+ warnings.warn("bdist_msi command is deprecated since Python 3.9, "
+ "use bdist_wheel (wheel packages) instead",
+ DeprecationWarning, 2)
+
def initialize_options(self):
self.bdist_dir = None
self.plat_name = None
@@ -398,18 +398,18 @@ class bdist_msi(Command):
# entries for each version as the above code does
if self.pre_install_script:
scriptfn = os.path.join(self.bdist_dir, "preinstall.bat")
- with open(scriptfn, "w") as f:
- # The batch file will be executed with [PYTHON], so that %1
- # is the path to the Python interpreter; %0 will be the path
- # of the batch file.
- # rem ="""
- # %1 %0
- # exit
- # """
- # <actual script>
- f.write('rem ="""\n%1 %0\nexit\n"""\n')
- with open(self.pre_install_script) as fin:
- f.write(fin.read())
+ with open(scriptfn, "w") as f:
+ # The batch file will be executed with [PYTHON], so that %1
+ # is the path to the Python interpreter; %0 will be the path
+ # of the batch file.
+ # rem ="""
+ # %1 %0
+ # exit
+ # """
+ # <actual script>
+ f.write('rem ="""\n%1 %0\nexit\n"""\n')
+ with open(self.pre_install_script) as fin:
+ f.write(fin.read())
add_data(self.db, "Binary",
[("PreInstall", msilib.Binary(scriptfn))
])
diff --git a/contrib/tools/python3/src/Lib/distutils/command/bdist_rpm.py b/contrib/tools/python3/src/Lib/distutils/command/bdist_rpm.py
index 550cbfa1e2..da98ce6a47 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/bdist_rpm.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/bdist_rpm.py
@@ -308,7 +308,7 @@ class bdist_rpm(Command):
# build package
log.info("building RPMs")
- rpm_cmd = ['rpmbuild']
+ rpm_cmd = ['rpmbuild']
if self.source_only: # what kind of RPMs?
rpm_cmd.append('-bs')
@@ -533,8 +533,8 @@ class bdist_rpm(Command):
'',
'%' + rpm_opt,])
if val:
- with open(val) as f:
- spec_file.extend(f.read().split('\n'))
+ with open(val) as f:
+ spec_file.extend(f.read().split('\n'))
else:
spec_file.append(default)
diff --git a/contrib/tools/python3/src/Lib/distutils/command/bdist_wininst.py b/contrib/tools/python3/src/Lib/distutils/command/bdist_wininst.py
index 0e9ddaa214..86602327cf 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/bdist_wininst.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/bdist_wininst.py
@@ -3,12 +3,12 @@
Implements the Distutils 'bdist_wininst' command: create a windows installer
exe-program."""
-import os
-import sys
-import warnings
+import os
+import sys
+import warnings
from distutils.core import Command
from distutils.util import get_platform
-from distutils.dir_util import remove_tree
+from distutils.dir_util import remove_tree
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
@@ -57,15 +57,15 @@ class bdist_wininst(Command):
boolean_options = ['keep-temp', 'no-target-compile', 'no-target-optimize',
'skip-build']
- # bpo-10945: bdist_wininst requires mbcs encoding only available on Windows
- _unsupported = (sys.platform != "win32")
-
- def __init__(self, *args, **kw):
- super().__init__(*args, **kw)
- warnings.warn("bdist_wininst command is deprecated since Python 3.8, "
- "use bdist_wheel (wheel packages) instead",
- DeprecationWarning, 2)
-
+ # bpo-10945: bdist_wininst requires mbcs encoding only available on Windows
+ _unsupported = (sys.platform != "win32")
+
+ def __init__(self, *args, **kw):
+ super().__init__(*args, **kw)
+ warnings.warn("bdist_wininst command is deprecated since Python 3.8, "
+ "use bdist_wheel (wheel packages) instead",
+ DeprecationWarning, 2)
+
def initialize_options(self):
self.bdist_dir = None
self.plat_name = None
@@ -258,49 +258,49 @@ class bdist_wininst(Command):
self.announce("creating %s" % installer_name)
if bitmap:
- with open(bitmap, "rb") as f:
- bitmapdata = f.read()
+ with open(bitmap, "rb") as f:
+ bitmapdata = f.read()
bitmaplen = len(bitmapdata)
else:
bitmaplen = 0
- with open(installer_name, "wb") as file:
- file.write(self.get_exe_bytes())
- if bitmap:
- file.write(bitmapdata)
+ with open(installer_name, "wb") as file:
+ file.write(self.get_exe_bytes())
+ if bitmap:
+ file.write(bitmapdata)
- # Convert cfgdata from unicode to ascii, mbcs encoded
- if isinstance(cfgdata, str):
- cfgdata = cfgdata.encode("mbcs")
+ # Convert cfgdata from unicode to ascii, mbcs encoded
+ if isinstance(cfgdata, str):
+ cfgdata = cfgdata.encode("mbcs")
- # Append the pre-install script
+ # Append the pre-install script
cfgdata = cfgdata + b"\0"
- if self.pre_install_script:
- # We need to normalize newlines, so we open in text mode and
- # convert back to bytes. "latin-1" simply avoids any possible
- # failures.
- with open(self.pre_install_script, "r",
- encoding="latin-1") as script:
- script_data = script.read().encode("latin-1")
- cfgdata = cfgdata + script_data + b"\n\0"
- else:
- # empty pre-install script
- cfgdata = cfgdata + b"\0"
- file.write(cfgdata)
-
- # The 'magic number' 0x1234567B is used to make sure that the
- # binary layout of 'cfgdata' is what the wininst.exe binary
- # expects. If the layout changes, increment that number, make
- # the corresponding changes to the wininst.exe sources, and
- # recompile them.
- header = struct.pack("<iii",
- 0x1234567B, # tag
- len(cfgdata), # length
- bitmaplen, # number of bytes in bitmap
- )
- file.write(header)
- with open(arcname, "rb") as f:
- file.write(f.read())
+ if self.pre_install_script:
+ # We need to normalize newlines, so we open in text mode and
+ # convert back to bytes. "latin-1" simply avoids any possible
+ # failures.
+ with open(self.pre_install_script, "r",
+ encoding="latin-1") as script:
+ script_data = script.read().encode("latin-1")
+ cfgdata = cfgdata + script_data + b"\n\0"
+ else:
+ # empty pre-install script
+ cfgdata = cfgdata + b"\0"
+ file.write(cfgdata)
+
+ # The 'magic number' 0x1234567B is used to make sure that the
+ # binary layout of 'cfgdata' is what the wininst.exe binary
+ # expects. If the layout changes, increment that number, make
+ # the corresponding changes to the wininst.exe sources, and
+ # recompile them.
+ header = struct.pack("<iii",
+ 0x1234567B, # tag
+ len(cfgdata), # length
+ bitmaplen, # number of bytes in bitmap
+ )
+ file.write(header)
+ with open(arcname, "rb") as f:
+ file.write(f.read())
def get_installer_filename(self, fullname):
# Factored out to allow overriding in subclasses
diff --git a/contrib/tools/python3/src/Lib/distutils/command/build.py b/contrib/tools/python3/src/Lib/distutils/command/build.py
index a86df0bc7f..fcdb21192e 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/build.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/build.py
@@ -116,7 +116,7 @@ class build(Command):
self.build_scripts = os.path.join(self.build_base,
'scripts-%d.%d' % sys.version_info[:2])
- if self.executable is None and sys.executable:
+ if self.executable is None and sys.executable:
self.executable = os.path.normpath(sys.executable)
if isinstance(self.parallel, str):
diff --git a/contrib/tools/python3/src/Lib/distutils/command/build_ext.py b/contrib/tools/python3/src/Lib/distutils/command/build_ext.py
index 1a9bd1200f..0785ec2bcb 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/build_ext.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/build_ext.py
@@ -490,8 +490,8 @@ class build_ext(Command):
"in 'ext_modules' option (extension '%s'), "
"'sources' must be present and must be "
"a list of source filenames" % ext.name)
- # sort to make the resulting .so file build reproducible
- sources = sorted(sources)
+ # sort to make the resulting .so file build reproducible
+ sources = sorted(sources)
ext_path = self.get_ext_fullpath(ext.name)
depends = sources + ext.depends
@@ -689,15 +689,15 @@ class build_ext(Command):
provided, "PyInit_" + module_name. Only relevant on Windows, where
the .pyd file (DLL) must export the module "PyInit_" function.
"""
- suffix = '_' + ext.name.split('.')[-1]
- try:
- # Unicode module name support as defined in PEP-489
- # https://www.python.org/dev/peps/pep-0489/#export-hook-name
- suffix.encode('ascii')
- except UnicodeEncodeError:
- suffix = 'U' + suffix.encode('punycode').replace(b'-', b'_').decode('ascii')
-
- initfunc_name = "PyInit" + suffix
+ suffix = '_' + ext.name.split('.')[-1]
+ try:
+ # Unicode module name support as defined in PEP-489
+ # https://www.python.org/dev/peps/pep-0489/#export-hook-name
+ suffix.encode('ascii')
+ except UnicodeEncodeError:
+ suffix = 'U' + suffix.encode('punycode').replace(b'-', b'_').decode('ascii')
+
+ initfunc_name = "PyInit" + suffix
if initfunc_name not in ext.export_symbols:
ext.export_symbols.append(initfunc_name)
return ext.export_symbols
@@ -724,31 +724,31 @@ class build_ext(Command):
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib]
else:
- # On Android only the main executable and LD_PRELOADs are considered
- # to be RTLD_GLOBAL, all the dependencies of the main executable
- # remain RTLD_LOCAL and so the shared libraries must be linked with
- # libpython when python is built with a shared python library (issue
- # bpo-21536).
- # On Cygwin (and if required, other POSIX-like platforms based on
- # Windows like MinGW) it is simply necessary that all symbols in
- # shared libraries are resolved at link time.
- from distutils.sysconfig import get_config_var
- link_libpython = False
- if get_config_var('Py_ENABLE_SHARED'):
- # A native build on an Android device or on Cygwin
- if hasattr(sys, 'getandroidapilevel'):
- link_libpython = True
- elif sys.platform == 'cygwin':
- link_libpython = True
- elif '_PYTHON_HOST_PLATFORM' in os.environ:
- # We are cross-compiling for one of the relevant platforms
- if get_config_var('ANDROID_API_LEVEL') != 0:
- link_libpython = True
- elif get_config_var('MACHDEP') == 'cygwin':
- link_libpython = True
-
- if link_libpython:
- ldversion = get_config_var('LDVERSION')
- return ext.libraries + ['python' + ldversion]
-
- return ext.libraries
+ # On Android only the main executable and LD_PRELOADs are considered
+ # to be RTLD_GLOBAL, all the dependencies of the main executable
+ # remain RTLD_LOCAL and so the shared libraries must be linked with
+ # libpython when python is built with a shared python library (issue
+ # bpo-21536).
+ # On Cygwin (and if required, other POSIX-like platforms based on
+ # Windows like MinGW) it is simply necessary that all symbols in
+ # shared libraries are resolved at link time.
+ from distutils.sysconfig import get_config_var
+ link_libpython = False
+ if get_config_var('Py_ENABLE_SHARED'):
+ # A native build on an Android device or on Cygwin
+ if hasattr(sys, 'getandroidapilevel'):
+ link_libpython = True
+ elif sys.platform == 'cygwin':
+ link_libpython = True
+ elif '_PYTHON_HOST_PLATFORM' in os.environ:
+ # We are cross-compiling for one of the relevant platforms
+ if get_config_var('ANDROID_API_LEVEL') != 0:
+ link_libpython = True
+ elif get_config_var('MACHDEP') == 'cygwin':
+ link_libpython = True
+
+ if link_libpython:
+ ldversion = get_config_var('LDVERSION')
+ return ext.libraries + ['python' + ldversion]
+
+ return ext.libraries
diff --git a/contrib/tools/python3/src/Lib/distutils/command/build_py.py b/contrib/tools/python3/src/Lib/distutils/command/build_py.py
index edc2171cd1..6a830d9e41 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/build_py.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/build_py.py
@@ -5,7 +5,7 @@ Implements the Distutils 'build_py' command."""
import os
import importlib.util
import sys
-import glob
+import glob
from distutils.core import Command
from distutils.errors import *
@@ -125,7 +125,7 @@ class build_py (Command):
files = []
for pattern in globs:
# Each pattern has to be converted to a platform-specific path
- filelist = glob.glob(os.path.join(glob.escape(src_dir), convert_path(pattern)))
+ filelist = glob.glob(os.path.join(glob.escape(src_dir), convert_path(pattern)))
# Files that match more than one pattern are only added once
files.extend([fn for fn in filelist if fn not in files
and os.path.isfile(fn)])
@@ -216,7 +216,7 @@ class build_py (Command):
def find_package_modules(self, package, package_dir):
self.check_package(package, package_dir)
- module_files = glob.glob(os.path.join(glob.escape(package_dir), "*.py"))
+ module_files = glob.glob(os.path.join(glob.escape(package_dir), "*.py"))
modules = []
setup_script = os.path.abspath(self.distribution.script_name)
diff --git a/contrib/tools/python3/src/Lib/distutils/command/check.py b/contrib/tools/python3/src/Lib/distutils/command/check.py
index 73a30f3afd..ee734cb1bc 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/check.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/check.py
@@ -79,12 +79,12 @@ class check(Command):
def check_metadata(self):
"""Ensures that all required elements of meta-data are supplied.
- Required fields:
- name, version, URL
-
- Recommended fields:
- (author and author_email) or (maintainer and maintainer_email)
+ Required fields:
+ name, version, URL
+ Recommended fields:
+ (author and author_email) or (maintainer and maintainer_email)
+
Warns if any are missing.
"""
metadata = self.distribution.metadata
@@ -99,15 +99,15 @@ class check(Command):
if metadata.author:
if not metadata.author_email:
self.warn("missing meta-data: if 'author' supplied, " +
- "'author_email' should be supplied too")
+ "'author_email' should be supplied too")
elif metadata.maintainer:
if not metadata.maintainer_email:
self.warn("missing meta-data: if 'maintainer' supplied, " +
- "'maintainer_email' should be supplied too")
+ "'maintainer_email' should be supplied too")
else:
self.warn("missing meta-data: either (author and author_email) " +
"or (maintainer and maintainer_email) " +
- "should be supplied")
+ "should be supplied")
def check_restructuredtext(self):
"""Checks if the long string fields are reST-compliant."""
@@ -122,8 +122,8 @@ class check(Command):
def _check_rst_data(self, data):
"""Returns warnings when the provided data doesn't compile."""
- # the include and csv_table directives need this to be a path
- source_path = self.distribution.script_name or 'setup.py'
+ # the include and csv_table directives need this to be a path
+ source_path = self.distribution.script_name or 'setup.py'
parser = Parser()
settings = frontend.OptionParser(components=(Parser,)).get_default_values()
settings.tab_width = 4
diff --git a/contrib/tools/python3/src/Lib/distutils/command/config.py b/contrib/tools/python3/src/Lib/distutils/command/config.py
index aeda408e73..316c2886c6 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/config.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/config.py
@@ -106,14 +106,14 @@ class config(Command):
def _gen_temp_sourcefile(self, body, headers, lang):
filename = "_configtest" + LANG_EXT[lang]
- with open(filename, "w") as file:
- if headers:
- for header in headers:
- file.write("#include <%s>\n" % header)
- file.write("\n")
- file.write(body)
- if body[-1] != "\n":
- file.write("\n")
+ with open(filename, "w") as file:
+ if headers:
+ for header in headers:
+ file.write("#include <%s>\n" % header)
+ file.write("\n")
+ file.write(body)
+ if body[-1] != "\n":
+ file.write("\n")
return filename
def _preprocess(self, body, headers, include_dirs, lang):
@@ -202,15 +202,15 @@ class config(Command):
if isinstance(pattern, str):
pattern = re.compile(pattern)
- with open(out) as file:
- match = False
- while True:
- line = file.readline()
- if line == '':
- break
- if pattern.search(line):
- match = True
- break
+ with open(out) as file:
+ match = False
+ while True:
+ line = file.readline()
+ if line == '':
+ break
+ if pattern.search(line):
+ match = True
+ break
self._clean()
return match
diff --git a/contrib/tools/python3/src/Lib/distutils/command/install.py b/contrib/tools/python3/src/Lib/distutils/command/install.py
index aaa300efa9..3f38e34363 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/install.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/install.py
@@ -30,14 +30,14 @@ WINDOWS_SCHEME = {
INSTALL_SCHEMES = {
'unix_prefix': {
'purelib': '$base/lib/python$py_version_short/site-packages',
- 'platlib': '$platbase/$platlibdir/python$py_version_short/site-packages',
+ 'platlib': '$platbase/$platlibdir/python$py_version_short/site-packages',
'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
'unix_home': {
'purelib': '$base/lib/python',
- 'platlib': '$base/$platlibdir/python',
+ 'platlib': '$base/$platlibdir/python',
'headers': '$base/include/python/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
@@ -223,7 +223,7 @@ class install(Command):
def finalize_options(self):
"""Finalizes options."""
- # This method (and its helpers, like 'finalize_unix()',
+ # This method (and its helpers, like 'finalize_unix()',
# 'finalize_other()', and 'select_scheme()') is where the default
# installation directories for modules, extension modules, and
# anything else we care to install from a Python module
@@ -298,7 +298,7 @@ class install(Command):
'sys_exec_prefix': exec_prefix,
'exec_prefix': exec_prefix,
'abiflags': abiflags,
- 'platlibdir': sys.platlibdir,
+ 'platlibdir': sys.platlibdir,
}
if HAS_USER_SITE:
diff --git a/contrib/tools/python3/src/Lib/distutils/command/sdist.py b/contrib/tools/python3/src/Lib/distutils/command/sdist.py
index b4996fcb1d..eae03d8cce 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/sdist.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/sdist.py
@@ -407,13 +407,13 @@ class sdist(Command):
distribution.
"""
log.info("reading manifest file '%s'", self.manifest)
- with open(self.manifest) as manifest:
- for line in manifest:
- # ignore comments and blank lines
- line = line.strip()
- if line.startswith('#') or not line:
- continue
- self.filelist.append(line)
+ with open(self.manifest) as manifest:
+ for line in manifest:
+ # ignore comments and blank lines
+ line = line.strip()
+ if line.startswith('#') or not line:
+ continue
+ self.filelist.append(line)
def make_release_tree(self, base_dir, files):
"""Create the directory tree that will become the source
diff --git a/contrib/tools/python3/src/Lib/distutils/command/upload.py b/contrib/tools/python3/src/Lib/distutils/command/upload.py
index e0ecb655b9..d23a29c8ab 100644
--- a/contrib/tools/python3/src/Lib/distutils/command/upload.py
+++ b/contrib/tools/python3/src/Lib/distutils/command/upload.py
@@ -9,24 +9,24 @@ import os
import io
import hashlib
from base64 import standard_b64encode
-from urllib.error import HTTPError
-from urllib.request import urlopen, Request
+from urllib.error import HTTPError
+from urllib.request import urlopen, Request
from urllib.parse import urlparse
from distutils.errors import DistutilsError, DistutilsOptionError
from distutils.core import PyPIRCCommand
from distutils.spawn import spawn
from distutils import log
-
-# PyPI Warehouse supports MD5, SHA256, and Blake2 (blake2-256)
-# https://bugs.python.org/issue40698
-_FILE_CONTENT_DIGESTS = {
- "md5_digest": getattr(hashlib, "md5", None),
- "sha256_digest": getattr(hashlib, "sha256", None),
- "blake2_256_digest": getattr(hashlib, "blake2b", None),
-}
-
-
+
+# PyPI Warehouse supports MD5, SHA256, and Blake2 (blake2-256)
+# https://bugs.python.org/issue40698
+_FILE_CONTENT_DIGESTS = {
+ "md5_digest": getattr(hashlib, "md5", None),
+ "sha256_digest": getattr(hashlib, "sha256", None),
+ "blake2_256_digest": getattr(hashlib, "blake2b", None),
+}
+
+
class upload(PyPIRCCommand):
description = "upload binary package to PyPI"
@@ -98,7 +98,7 @@ class upload(PyPIRCCommand):
content = f.read()
finally:
f.close()
-
+
meta = self.distribution.metadata
data = {
# action
@@ -132,22 +132,22 @@ class upload(PyPIRCCommand):
'obsoletes': meta.get_obsoletes(),
}
- data['comment'] = ''
-
- # file content digests
- for digest_name, digest_cons in _FILE_CONTENT_DIGESTS.items():
- if digest_cons is None:
- continue
- try:
- data[digest_name] = digest_cons(content).hexdigest()
- except ValueError:
- # hash digest not available or blocked by security policy
- pass
-
+ data['comment'] = ''
+
+ # file content digests
+ for digest_name, digest_cons in _FILE_CONTENT_DIGESTS.items():
+ if digest_cons is None:
+ continue
+ try:
+ data[digest_name] = digest_cons(content).hexdigest()
+ except ValueError:
+ # hash digest not available or blocked by security policy
+ pass
+
if self.sign:
- with open(filename + ".asc", "rb") as f:
- data['gpg_signature'] = (os.path.basename(filename) + ".asc",
- f.read())
+ with open(filename + ".asc", "rb") as f:
+ data['gpg_signature'] = (os.path.basename(filename) + ".asc",
+ f.read())
# set up the authentication
user_pass = (self.username + ":" + self.password).encode('ascii')
diff --git a/contrib/tools/python3/src/Lib/distutils/msvc9compiler.py b/contrib/tools/python3/src/Lib/distutils/msvc9compiler.py
index a7976fbe3e..b4f36f44ad 100644
--- a/contrib/tools/python3/src/Lib/distutils/msvc9compiler.py
+++ b/contrib/tools/python3/src/Lib/distutils/msvc9compiler.py
@@ -19,7 +19,7 @@ import re
from distutils.errors import DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError
-from distutils.ccompiler import CCompiler, gen_lib_options
+from distutils.ccompiler import CCompiler, gen_lib_options
from distutils import log
from distutils.util import get_platform
@@ -673,7 +673,7 @@ class MSVCCompiler(CCompiler) :
# If a manifest should be embedded, return a tuple of
# (manifest_filename, resource_id). Returns None if no manifest
# should be embedded. See http://bugs.python.org/issue7833 for why
- # we want to avoid any manifest for extension modules if we can.
+ # we want to avoid any manifest for extension modules if we can.
for arg in ld_args:
if arg.startswith("/MANIFESTFILE:"):
temp_manifest = arg.split(":", 1)[1]
diff --git a/contrib/tools/python3/src/Lib/distutils/msvccompiler.py b/contrib/tools/python3/src/Lib/distutils/msvccompiler.py
index d5857cb1ff..cc2c16ae1b 100644
--- a/contrib/tools/python3/src/Lib/distutils/msvccompiler.py
+++ b/contrib/tools/python3/src/Lib/distutils/msvccompiler.py
@@ -13,7 +13,7 @@ from distutils.errors import \
DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError
from distutils.ccompiler import \
- CCompiler, gen_lib_options
+ CCompiler, gen_lib_options
from distutils import log
_can_read_reg = False
diff --git a/contrib/tools/python3/src/Lib/distutils/spawn.py b/contrib/tools/python3/src/Lib/distutils/spawn.py
index 31df3f7fac..5ea8f7801d 100644
--- a/contrib/tools/python3/src/Lib/distutils/spawn.py
+++ b/contrib/tools/python3/src/Lib/distutils/spawn.py
@@ -8,18 +8,18 @@ executable name.
import sys
import os
-import subprocess
+import subprocess
from distutils.errors import DistutilsPlatformError, DistutilsExecError
from distutils.debug import DEBUG
from distutils import log
-
-if sys.platform == 'darwin':
- _cfg_target = None
- _cfg_target_split = None
-
-
+
+if sys.platform == 'darwin':
+ _cfg_target = None
+ _cfg_target_split = None
+
+
def spawn(cmd, search_path=1, verbose=0, dry_run=0):
"""Run another program, specified as a command list 'cmd', in a new process.
@@ -40,90 +40,90 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0):
# in, protect our %-formatting code against horrible death
cmd = list(cmd)
- log.info(' '.join(cmd))
- if dry_run:
- return
+ log.info(' '.join(cmd))
+ if dry_run:
+ return
if search_path:
- executable = find_executable(cmd[0])
- if executable is not None:
- cmd[0] = executable
+ executable = find_executable(cmd[0])
+ if executable is not None:
+ cmd[0] = executable
env = None
if sys.platform == 'darwin':
global _cfg_target, _cfg_target_split
if _cfg_target is None:
- from distutils import sysconfig
- _cfg_target = sysconfig.get_config_var(
- 'MACOSX_DEPLOYMENT_TARGET') or ''
+ from distutils import sysconfig
+ _cfg_target = sysconfig.get_config_var(
+ 'MACOSX_DEPLOYMENT_TARGET') or ''
if _cfg_target:
_cfg_target_split = [int(x) for x in _cfg_target.split('.')]
if _cfg_target:
- # Ensure that the deployment target of the build process is not
- # less than 10.3 if the interpreter was built for 10.3 or later.
- # This ensures extension modules are built with correct
- # compatibility values, specifically LDSHARED which can use
- # '-undefined dynamic_lookup' which only works on >= 10.3.
+ # Ensure that the deployment target of the build process is not
+ # less than 10.3 if the interpreter was built for 10.3 or later.
+ # This ensures extension modules are built with correct
+ # compatibility values, specifically LDSHARED which can use
+ # '-undefined dynamic_lookup' which only works on >= 10.3.
cur_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
- cur_target_split = [int(x) for x in cur_target.split('.')]
- if _cfg_target_split[:2] >= [10, 3] and cur_target_split[:2] < [10, 3]:
+ cur_target_split = [int(x) for x in cur_target.split('.')]
+ if _cfg_target_split[:2] >= [10, 3] and cur_target_split[:2] < [10, 3]:
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
- 'now "%s" but "%s" during configure;'
- 'must use 10.3 or later'
+ 'now "%s" but "%s" during configure;'
+ 'must use 10.3 or later'
% (cur_target, _cfg_target))
raise DistutilsPlatformError(my_msg)
env = dict(os.environ,
MACOSX_DEPLOYMENT_TARGET=cur_target)
- try:
- proc = subprocess.Popen(cmd, env=env)
- proc.wait()
- exitcode = proc.returncode
- except OSError as exc:
- if not DEBUG:
- cmd = cmd[0]
- raise DistutilsExecError(
- "command %r failed: %s" % (cmd, exc.args[-1])) from exc
-
- if exitcode:
+ try:
+ proc = subprocess.Popen(cmd, env=env)
+ proc.wait()
+ exitcode = proc.returncode
+ except OSError as exc:
if not DEBUG:
- cmd = cmd[0]
- raise DistutilsExecError(
- "command %r failed with exit code %s" % (cmd, exitcode))
-
-
+ cmd = cmd[0]
+ raise DistutilsExecError(
+ "command %r failed: %s" % (cmd, exc.args[-1])) from exc
+
+ if exitcode:
+ if not DEBUG:
+ cmd = cmd[0]
+ raise DistutilsExecError(
+ "command %r failed with exit code %s" % (cmd, exitcode))
+
+
def find_executable(executable, path=None):
"""Tries to find 'executable' in the directories listed in 'path'.
A string listing directories separated by 'os.pathsep'; defaults to
os.environ['PATH']. Returns the complete filename or None if not found.
"""
- _, ext = os.path.splitext(executable)
+ _, ext = os.path.splitext(executable)
if (sys.platform == 'win32') and (ext != '.exe'):
executable = executable + '.exe'
- if os.path.isfile(executable):
- return executable
-
- if path is None:
- path = os.environ.get('PATH', None)
- if path is None:
- try:
- path = os.confstr("CS_PATH")
- except (AttributeError, ValueError):
- # os.confstr() or CS_PATH is not available
- path = os.defpath
- # bpo-35755: Don't use os.defpath if the PATH environment variable is
- # set to an empty string
-
- # PATH='' doesn't match, whereas PATH=':' looks in the current directory
- if not path:
+ if os.path.isfile(executable):
+ return executable
+
+ if path is None:
+ path = os.environ.get('PATH', None)
+ if path is None:
+ try:
+ path = os.confstr("CS_PATH")
+ except (AttributeError, ValueError):
+ # os.confstr() or CS_PATH is not available
+ path = os.defpath
+ # bpo-35755: Don't use os.defpath if the PATH environment variable is
+ # set to an empty string
+
+ # PATH='' doesn't match, whereas PATH=':' looks in the current directory
+ if not path:
return None
-
- paths = path.split(os.pathsep)
- for p in paths:
- f = os.path.join(p, executable)
- if os.path.isfile(f):
- # the file exists, we have a shot at spawn working
- return f
- return None
+
+ paths = path.split(os.pathsep)
+ for p in paths:
+ f = os.path.join(p, executable)
+ if os.path.isfile(f):
+ # the file exists, we have a shot at spawn working
+ return f
+ return None
diff --git a/contrib/tools/python3/src/Lib/distutils/sysconfig.py b/contrib/tools/python3/src/Lib/distutils/sysconfig.py
index 4e5464705b..93e347c05b 100644
--- a/contrib/tools/python3/src/Lib/distutils/sysconfig.py
+++ b/contrib/tools/python3/src/Lib/distutils/sysconfig.py
@@ -28,19 +28,19 @@ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
- if sys.executable:
- project_base = os.path.dirname(os.path.abspath(sys.executable))
- else:
- # sys.executable can be empty if argv[0] has been changed and Python is
- # unable to retrieve the real program name
- project_base = os.getcwd()
+ if sys.executable:
+ project_base = os.path.dirname(os.path.abspath(sys.executable))
+ else:
+ # sys.executable can be empty if argv[0] has been changed and Python is
+ # unable to retrieve the real program name
+ project_base = os.getcwd()
# python_build: (Boolean) if true, we're either building Python or
# building an extension with an un-installed Python, so we use
# different (hard-wired) directories.
def _is_python_source_dir(d):
- for fn in ("Setup", "Setup.local"):
+ for fn in ("Setup", "Setup.local"):
if os.path.isfile(os.path.join(d, "Modules", fn)):
return True
return False
@@ -145,15 +145,15 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
- if plat_specific or standard_lib:
- # Platform-specific modules (any module from a non-pure-Python
- # module distribution) or standard Python library modules.
- libdir = sys.platlibdir
- else:
- # Pure Python
- libdir = "lib"
- libpython = os.path.join(prefix, libdir,
- "python" + get_python_version())
+ if plat_specific or standard_lib:
+ # Platform-specific modules (any module from a non-pure-Python
+ # module distribution) or standard Python library modules.
+ libdir = sys.platlibdir
+ else:
+ # Pure Python
+ libdir = "lib"
+ libpython = os.path.join(prefix, libdir,
+ "python" + get_python_version())
if standard_lib:
return libpython
else:
@@ -193,8 +193,8 @@ def customize_compiler(compiler):
_osx_support.customize_compiler(_config_vars)
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
- get_config_vars('CC', 'CXX', 'CFLAGS',
+ (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+ get_config_vars('CC', 'CXX', 'CFLAGS',
'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
if 'CC' in os.environ:
@@ -217,7 +217,7 @@ def customize_compiler(compiler):
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
if 'CFLAGS' in os.environ:
- cflags = cflags + ' ' + os.environ['CFLAGS']
+ cflags = cflags + ' ' + os.environ['CFLAGS']
ldshared = ldshared + ' ' + os.environ['CFLAGS']
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
diff --git a/contrib/tools/python3/src/Lib/distutils/unixccompiler.py b/contrib/tools/python3/src/Lib/distutils/unixccompiler.py
index d00c48981e..38e4546b6f 100644
--- a/contrib/tools/python3/src/Lib/distutils/unixccompiler.py
+++ b/contrib/tools/python3/src/Lib/distutils/unixccompiler.py
@@ -215,8 +215,8 @@ class UnixCCompiler(CCompiler):
return "-L" + dir
def _is_gcc(self, compiler_name):
- # clang uses same syntax for rpath as gcc
- return any(name in compiler_name for name in ("gcc", "g++", "clang"))
+ # clang uses same syntax for rpath as gcc
+ return any(name in compiler_name for name in ("gcc", "g++", "clang"))
def runtime_library_dir_option(self, dir):
# XXX Hackish, at the very least. See Python bug #445902:
@@ -289,9 +289,9 @@ class UnixCCompiler(CCompiler):
# vs
# /usr/lib/libedit.dylib
cflags = sysconfig.get_config_var('CFLAGS')
- m = re.search(r'-isysroot\s*(\S+)', cflags)
+ m = re.search(r'-isysroot\s*(\S+)', cflags)
if m is None:
- sysroot = _osx_support._default_sysroot(sysconfig.get_config_var('CC'))
+ sysroot = _osx_support._default_sysroot(sysconfig.get_config_var('CC'))
else:
sysroot = m.group(1)
diff --git a/contrib/tools/python3/src/Lib/distutils/util.py b/contrib/tools/python3/src/Lib/distutils/util.py
index 4b002ecef1..a55af04a8d 100644
--- a/contrib/tools/python3/src/Lib/distutils/util.py
+++ b/contrib/tools/python3/src/Lib/distutils/util.py
@@ -15,7 +15,7 @@ from distutils.spawn import spawn
from distutils import log
from distutils.errors import DistutilsByteCompileError
-def get_host_platform():
+def get_host_platform():
"""Return a string that identifies the current platform. This is used mainly to
distinguish platform-specific build directories and platform-specific built
distributions. Typically includes the OS name and version and the
@@ -38,10 +38,10 @@ def get_host_platform():
if os.name == 'nt':
if 'amd64' in sys.version.lower():
return 'win-amd64'
- if '(arm)' in sys.version.lower():
- return 'win-arm32'
- if '(arm64)' in sys.version.lower():
- return 'win-arm64'
+ if '(arm)' in sys.version.lower():
+ return 'win-arm32'
+ if '(arm64)' in sys.version.lower():
+ return 'win-arm64'
return sys.platform
# Set for cross builds explicitly
@@ -79,8 +79,8 @@ def get_host_platform():
machine += ".%s" % bitness[sys.maxsize]
# fall through to standard osname-release-machine representation
elif osname[:3] == "aix":
- from _aix_support import aix_platform
- return aix_platform()
+ from _aix_support import aix_platform
+ return aix_platform()
elif osname[:6] == "cygwin":
osname = "cygwin"
rel_re = re.compile (r'[\d.]+', re.ASCII)
@@ -95,16 +95,16 @@ def get_host_platform():
return "%s-%s-%s" % (osname, release, machine)
-def get_platform():
- if os.name == 'nt':
- TARGET_TO_PLAT = {
- 'x86' : 'win32',
- 'x64' : 'win-amd64',
- 'arm' : 'win-arm32',
- }
- return TARGET_TO_PLAT.get(os.environ.get('VSCMD_ARG_TGT_ARCH')) or get_host_platform()
- else:
- return get_host_platform()
+def get_platform():
+ if os.name == 'nt':
+ TARGET_TO_PLAT = {
+ 'x86' : 'win32',
+ 'x64' : 'win-amd64',
+ 'arm' : 'win-arm32',
+ }
+ return TARGET_TO_PLAT.get(os.environ.get('VSCMD_ARG_TGT_ARCH')) or get_host_platform()
+ else:
+ return get_host_platform()
def convert_path (pathname):
"""Return 'pathname' as a name that will work on the native filesystem,
@@ -391,28 +391,28 @@ def byte_compile (py_files,
else:
script = open(script_name, "w")
- with script:
- script.write("""\
+ with script:
+ script.write("""\
from distutils.util import byte_compile
files = [
""")
- # XXX would be nice to write absolute filenames, just for
- # safety's sake (script should be more robust in the face of
- # chdir'ing before running it). But this requires abspath'ing
- # 'prefix' as well, and that breaks the hack in build_lib's
- # 'byte_compile()' method that carefully tacks on a trailing
- # slash (os.sep really) to make sure the prefix here is "just
- # right". This whole prefix business is rather delicate -- the
- # problem is that it's really a directory, but I'm treating it
- # as a dumb string, so trailing slashes and so forth matter.
-
- #py_files = map(os.path.abspath, py_files)
- #if prefix:
- # prefix = os.path.abspath(prefix)
-
- script.write(",\n".join(map(repr, py_files)) + "]\n")
- script.write("""
+ # XXX would be nice to write absolute filenames, just for
+ # safety's sake (script should be more robust in the face of
+ # chdir'ing before running it). But this requires abspath'ing
+ # 'prefix' as well, and that breaks the hack in build_lib's
+ # 'byte_compile()' method that carefully tacks on a trailing
+ # slash (os.sep really) to make sure the prefix here is "just
+ # right". This whole prefix business is rather delicate -- the
+ # problem is that it's really a directory, but I'm treating it
+ # as a dumb string, so trailing slashes and so forth matter.
+
+ #py_files = map(os.path.abspath, py_files)
+ #if prefix:
+ # prefix = os.path.abspath(prefix)
+
+ script.write(",\n".join(map(repr, py_files)) + "]\n")
+ script.write("""
byte_compile(files, optimize=%r, force=%r,
prefix=%r, base_dir=%r,
verbose=%r, dry_run=0,
diff --git a/contrib/tools/python3/src/Lib/distutils/version.py b/contrib/tools/python3/src/Lib/distutils/version.py
index c33bebaed2..4ce1e764da 100644
--- a/contrib/tools/python3/src/Lib/distutils/version.py
+++ b/contrib/tools/python3/src/Lib/distutils/version.py
@@ -166,8 +166,8 @@ class StrictVersion (Version):
def _cmp (self, other):
if isinstance(other, str):
other = StrictVersion(other)
- elif not isinstance(other, StrictVersion):
- return NotImplemented
+ elif not isinstance(other, StrictVersion):
+ return NotImplemented
if self.version != other.version:
# numeric versions don't match
@@ -333,8 +333,8 @@ class LooseVersion (Version):
def _cmp (self, other):
if isinstance(other, str):
other = LooseVersion(other)
- elif not isinstance(other, LooseVersion):
- return NotImplemented
+ elif not isinstance(other, LooseVersion):
+ return NotImplemented
if self.version == other.version:
return 0