cpython: 935d7804d1be (original) (raw)

--- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -64,9 +64,10 @@ The header files are typically installed located in the directories :file:{prefix}/include/pythonversion/ and :file:{exec_prefix}/include/pythonversion/, where :envvar:prefix and :envvar:exec_prefix are defined by the corresponding parameters to Python's -:program:configure script and version is sys.version[:3]. On Windows, -the headers are installed in :file:{prefix}/include, where :envvar:prefix is -the installation directory specified to the installer. +:program:configure script and version is +'%d.%d' % sys.version_info[:2]. On Windows, the headers are installed +in :file:{prefix}/include, where :envvar:prefix is the installation +directory specified to the installer. To include the headers, place both directories (if different) on your compiler's search path for includes. Do not place the parent directories on the search

--- a/Doc/includes/test.py +++ b/Doc/includes/test.py @@ -204,7 +204,7 @@ 2 import os import sys from distutils.util import get_platform -PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3]) +PLAT_SPEC = "%s-%d.%d" % (get_platform(), *sys.version_info[:2]) src = os.path.join("build", "lib.%s" % PLAT_SPEC) sys.path.append(src)

--- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -163,7 +163,7 @@ Other functions .. function:: get_python_version() Return the MAJOR.MINOR Python version number as a string. Similar to

.. function:: get_platform()

--- a/Lib/distutils/command/bdist_msi.py +++ b/Lib/distutils/command/bdist_msi.py @@ -199,7 +199,7 @@ class bdist_msi(Command): target_version = self.target_version if not target_version: assert self.skip_build, "Should have already checked this"

--- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -141,7 +141,7 @@ class bdist_wininst(Command): target_version = self.target_version if not target_version: assert self.skip_build, "Should have already checked this"

--- a/Lib/distutils/command/build.py +++ b/Lib/distutils/command/build.py @@ -81,7 +81,7 @@ class build(Command): "--plat-name only supported on Windows (try " "using './configure --help' on your platform)")

# Make it so Python 2.x and Python 2.x with --with-pydebug don't # share the same build directories. Doing so confuses the build @@ -114,7 +114,7 @@ class build(Command): 'temp' + plat_specifier) if self.build_scripts is None: self.build_scripts = os.path.join(self.build_base,

if self.executable is None: self.executable = os.path.normpath(sys.executable)

--- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -290,8 +290,8 @@ class install(Command): 'dist_version': self.distribution.get_version(), 'dist_fullname': self.distribution.get_fullname(), 'py_version': py_version,

--- a/Lib/distutils/command/install_egg_info.py +++ b/Lib/distutils/command/install_egg_info.py @@ -21,10 +21,10 @@ class install_egg_info(Command): def finalize_options(self): self.set_undefined_options('install_lib',('install_dir','install_dir'))

--- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -70,7 +70,7 @@ def get_python_version(): leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. """

def get_python_inc(plat_specific=0, prefix=None):

--- a/Lib/distutils/tests/test_build.py +++ b/Lib/distutils/tests/test_build.py @@ -27,7 +27,7 @@ class BuildTestCase(support.TempdirManag # build_platlib is 'build/lib.platform-x.x[-pydebug]' # examples: # build/lib.macosx-10.3-i386-2.7

@@ -42,7 +42,8 @@ class BuildTestCase(support.TempdirManag self.assertEqual(cmd.build_temp, wanted) # build_scripts is build/scripts-x.x

# executable is os.path.normpath(sys.executable)

--- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -593,7 +593,7 @@ class WindowsRegistryFinder: else: registry_key = cls.REGISTRY_KEY key = registry_key.format(fullname=fullname,

--- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1911,10 +1911,10 @@ has the same effect as typing a particul def intro(self): self.output.write(''' -Welcome to Python %s's help utility +Welcome to Python {0}'s help utility If this is your first time using Python, you should definitely check out -the tutorial on the Internet at http://docs.python.org/%s/tutorial/.[](#l12.11) +the tutorial on the Internet at http://docs.python.org/{0}/tutorial/.[](#l12.12) Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and @@ -1924,7 +1924,7 @@ To get a list of available modules, keyw "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". -''' % tuple([sys.version[:3]]*2)) +'''.format('%d.%d' % sys.version_info[:2])) def list(self, items, columns=4, width=80): items = list(sorted(items))

--- a/Lib/site.py +++ b/Lib/site.py @@ -304,7 +304,7 @@ def getsitepackages(prefixes=None): if os.sep == '/': sitepackages.append(os.path.join(prefix, "lib",

@@ -317,7 +317,7 @@ def getsitepackages(prefixes=None): if framework: sitepackages.append( os.path.join("/Library", framework,

--- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -86,8 +86,8 @@ from os.path import pardir, realpath

FIXME don't rely on sys.version here, its format is an implementation detail

of CPython, use sys.version_info or sys.hexversion

_PY_VERSION = sys.version.split()[0] -_PY_VERSION_SHORT = sys.version[:3] -_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2] +_PY_VERSION_SHORT = '%d.%d' % sys.version_info[:2] +_PY_VERSION_SHORT_NO_DOT = '%d%d' % sys.version_info[:2] _PREFIX = os.path.normpath(sys.prefix) _BASE_PREFIX = os.path.normpath(sys.base_prefix) _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) @@ -386,7 +386,7 @@ def _generate_posix_vars(): module.build_time_vars = vars sys.modules[name] = module

--- a/Lib/test/test_importlib/test_windows.py +++ b/Lib/test/test_importlib/test_windows.py @@ -40,7 +40,7 @@ def setup_module(machinery, name, path=N else: root = machinery.WindowsRegistryFinder.REGISTRY_KEY key = root.format(fullname=name,

--- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -238,13 +238,14 @@ class HelperFunctionsTests(unittest.Test self.assertEqual(len(dirs), 2) wanted = os.path.join('/Library', sysconfig.get_config_var("PYTHONFRAMEWORK"),

--- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -51,7 +51,7 @@ class BaseTest(unittest.TestCase): self.include = 'Include' else: self.bindir = 'bin'

--- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -133,7 +133,7 @@ else: ]

used in User-Agent header sent

-version = sys.version[:3] +version = '%d.%d' % sys.version_info[:2] _opener = None def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,

--- a/Lib/xmlrpc/client.py +++ b/Lib/xmlrpc/client.py @@ -151,7 +151,7 @@ def escape(s): return s.replace(">", ">",)

used in User-Agent header sent

-version = sys.version[:3] +version = '%d.%d' % sys.version_info[:2]

xmlrpc integer limits

MAXINT = 2**31-1

--- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -568,7 +568,7 @@ clinic: $(BUILDPYTHON) (LINKCC)(LINKCC) (LINKCC)(PY_LDFLAGS) (LINKFORSHARED)−o(LINKFORSHARED) -o (LINKFORSHARED)o@ Programs/python.o (BLDLIBRARY)(BLDLIBRARY) (BLDLIBRARY)(LIBS) (MODLIBS)(MODLIBS) (MODLIBS)(SYSLIBS) $(LDLAST) platform: $(BUILDPYTHON) pybuilddir.txt

Create build directory and generate the sysconfig build-time data there.

pybuilddir.txt contains the name of the build dir and is used for

--- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -888,22 +888,23 @@ const unsigned char _Py_M__importlib_ext 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, 105,110,100,101,114,46,95,111,112,101,110,95,114,101,103,105, 115,116,114,121,99,2,0,0,0,0,0,0,0,6,0,0,

--- a/Tools/freeze/freeze.py +++ b/Tools/freeze/freeze.py @@ -218,7 +218,7 @@ def main(): ishome = os.path.exists(os.path.join(prefix, 'Python', 'ceval.c')) # locations derived from options

--- a/Tools/scripts/nm2def.py +++ b/Tools/scripts/nm2def.py @@ -36,8 +36,8 @@ option to produce this format (since it """ import os, sys -PYTHONLIB = 'libpython'+sys.version[:3]+'.a' -PC_PYTHONLIB = 'Python'+sys.version[0]+sys.version[2]+'.dll' +PYTHONLIB = 'libpython%d.%d.a' % sys.version_info[:2] +PC_PYTHONLIB = 'Python%d%d.dll' % sys.version_info[:2] NM = 'nm -p -g %s' # For Linux, use "nm -g %s" def symbols(lib=PYTHONLIB,types=('T','C','D')):

--- a/setup.py +++ b/setup.py @@ -2226,7 +2226,7 @@ def main(): setup(# PyPI Metadata (PEP 301) name = "Python", version = sys.version.split()[0],