| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,9 +64,10 @@ The header files are typically installed with Python. On Unix, these are | |||
| 64 | 64 | located in the directories :file:`{prefix}/include/pythonversion/` and | |
| 65 | 65 | :file:`{exec_prefix}/include/pythonversion/`, where :envvar:`prefix` and | |
| 66 | 66 | :envvar:`exec_prefix` are defined by the corresponding parameters to Python's | |
| 67 | - :program:`configure` script and *version* is ``sys.version[:3]``. On Windows, | ||
| 68 | - the headers are installed in :file:`{prefix}/include`, where :envvar:`prefix` is | ||
| 69 | - the installation directory specified to the installer. | ||
| 67 | + :program:`configure` script and *version* is | ||
| 68 | + ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers are installed | ||
| 69 | + in :file:`{prefix}/include`, where :envvar:`prefix` is the installation | ||
| 70 | + directory specified to the installer. | ||
| 70 | 71 | ||
| 71 | 72 | To include the headers, place both directories (if different) on your compiler's | |
| 72 | 73 | search path for includes. Do *not* place the parent directories on the search | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -204,7 +204,7 @@ | |||
| 204 | 204 | import os | |
| 205 | 205 | import sys | |
| 206 | 206 | from distutils.util import get_platform | |
| 207 | - PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3]) | ||
| 207 | + PLAT_SPEC = "%s-%d.%d" % (get_platform(), *sys.version_info[:2]) | ||
| 208 | 208 | src = os.path.join("build", "lib.%s" % PLAT_SPEC) | |
| 209 | 209 | sys.path.append(src) | |
| 210 | 210 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -163,7 +163,7 @@ Other functions | |||
| 163 | 163 | .. function:: get_python_version() | |
| 164 | 164 | ||
| 165 | 165 | Return the ``MAJOR.MINOR`` Python version number as a string. Similar to | |
| 166 | - ``sys.version[:3]``. | ||
| 166 | + ``'%d.%d' % sys.version_info[:2]``. | ||
| 167 | 167 | ||
| 168 | 168 | ||
| 169 | 169 | .. function:: get_platform() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -199,7 +199,7 @@ def run(self): | |||
| 199 | 199 | target_version = self.target_version | |
| 200 | 200 | if not target_version: | |
| 201 | 201 | assert self.skip_build, "Should have already checked this" | |
| 202 | - target_version = sys.version[0:3] | ||
| 202 | + target_version = '%d.%d' % sys.version_info[:2] | ||
| 203 | 203 | plat_specifier = ".%s-%s" % (self.plat_name, target_version) | |
| 204 | 204 | build = self.get_finalized_command('build') | |
| 205 | 205 | build.build_lib = os.path.join(build.build_base, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,7 +141,7 @@ def run(self): | |||
| 141 | 141 | target_version = self.target_version | |
| 142 | 142 | if not target_version: | |
| 143 | 143 | assert self.skip_build, "Should have already checked this" | |
| 144 | - target_version = sys.version[0:3] | ||
| 144 | + target_version = '%d.%d' % sys.version_info[:2] | ||
| 145 | 145 | plat_specifier = ".%s-%s" % (self.plat_name, target_version) | |
| 146 | 146 | build = self.get_finalized_command('build') | |
| 147 | 147 | build.build_lib = os.path.join(build.build_base, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,7 +81,7 @@ def finalize_options(self): | |||
| 81 | 81 | "--plat-name only supported on Windows (try " | |
| 82 | 82 | "using './configure --help' on your platform)") | |
| 83 | 83 | ||
| 84 | - plat_specifier = ".%s-%s" % (self.plat_name, sys.version[0:3]) | ||
| 84 | + plat_specifier = ".%s-%d.%d" % (self.plat_name, *sys.version_info[:2]) | ||
| 85 | 85 | ||
| 86 | 86 | # Make it so Python 2.x and Python 2.x with --with-pydebug don't | |
| 87 | 87 | # share the same build directories. Doing so confuses the build | |
@@ -114,7 +114,7 @@ def finalize_options(self): | |||
| 114 | 114 | 'temp' + plat_specifier) | |
| 115 | 115 | if self.build_scripts is None: | |
| 116 | 116 | self.build_scripts = os.path.join(self.build_base, | |
| 117 | - 'scripts-' + sys.version[0:3]) | ||
| 117 | + 'scripts-%d.%d' % sys.version_info[:2]) | ||
| 118 | 118 | ||
| 119 | 119 | if self.executable is None: | |
| 120 | 120 | self.executable = os.path.normpath(sys.executable) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -290,8 +290,8 @@ def finalize_options(self): | |||
| 290 | 290 | 'dist_version': self.distribution.get_version(), | |
| 291 | 291 | 'dist_fullname': self.distribution.get_fullname(), | |
| 292 | 292 | 'py_version': py_version, | |
| 293 | - 'py_version_short': py_version[0:3], | ||
| 294 | - 'py_version_nodot': py_version[0] + py_version[2], | ||
| 293 | + 'py_version_short': '%d.%d' % sys.version_info[:2], | ||
| 294 | + 'py_version_nodot': '%d%d' % sys.version_info[:2], | ||
| 295 | 295 | 'sys_prefix': prefix, | |
| 296 | 296 | 'prefix': prefix, | |
| 297 | 297 | 'sys_exec_prefix': exec_prefix, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,10 +21,10 @@ def initialize_options(self): | |||
| 21 | 21 | ||
| 22 | 22 | def finalize_options(self): | |
| 23 | 23 | self.set_undefined_options('install_lib',('install_dir','install_dir')) | |
| 24 | - basename = "%s-%s-py%s.egg-info" % ( | ||
| 24 | + basename = "%s-%s-py%d.%d.egg-info" % ( | ||
| 25 | 25 | to_filename(safe_name(self.distribution.get_name())), | |
| 26 | 26 | to_filename(safe_version(self.distribution.get_version())), | |
| 27 | - sys.version[:3] | ||
| 27 | + *sys.version_info[:2] | ||
| 28 | 28 | ) | |
| 29 | 29 | self.target = os.path.join(self.install_dir, basename) | |
| 30 | 30 | self.outputs = [self.target] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,7 +70,7 @@ def get_python_version(): | |||
| 70 | 70 | leaving off the patchlevel. Sample return values could be '1.5' | |
| 71 | 71 | or '2.2'. | |
| 72 | 72 | """ | |
| 73 | - return sys.version[:3] | ||
| 73 | + return '%d.%d' % sys.version_info[:2] | ||
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | 76 | def get_python_inc(plat_specific=0, prefix=None): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ def test_finalize_options(self): | |||
| 27 | 27 | # build_platlib is 'build/lib.platform-x.x[-pydebug]' | |
| 28 | 28 | # examples: | |
| 29 | 29 | # build/lib.macosx-10.3-i386-2.7 | |
| 30 | - plat_spec = '.%s-%s' % (cmd.plat_name, sys.version[0:3]) | ||
| 30 | + plat_spec = '.%s-%d.%d' % (cmd.plat_name, *sys.version_info[:2]) | ||
| 31 | 31 | if hasattr(sys, 'gettotalrefcount'): | |
| 32 | 32 | self.assertTrue(cmd.build_platlib.endswith('-pydebug')) | |
| 33 | 33 | plat_spec += '-pydebug' | |
@@ -42,7 +42,8 @@ def test_finalize_options(self): | |||
| 42 | 42 | self.assertEqual(cmd.build_temp, wanted) | |
| 43 | 43 | ||
| 44 | 44 | # build_scripts is build/scripts-x.x | |
| 45 | - wanted = os.path.join(cmd.build_base, 'scripts-' + sys.version[0:3]) | ||
| 45 | + wanted = os.path.join(cmd.build_base, | ||
| 46 | + 'scripts-%d.%d' % sys.version_info[:2]) | ||
| 46 | 47 | self.assertEqual(cmd.build_scripts, wanted) | |
| 47 | 48 | ||
| 48 | 49 | # executable is os.path.normpath(sys.executable) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments