mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Packaging cleanup: remove conditionals for < 2.6 support.
PEP 370 features and sys.dont_write_bytecode are always available in 3.3; the distutils2 backport still has the conditionals. I also renamed an internal misnamed method and fixed a few things (“packaging2” name, stray print, unused import, fd leak).
This commit is contained in:
parent
37ccd6f794
commit
7724a6c10c
16 changed files with 47 additions and 96 deletions
|
@ -3,6 +3,7 @@
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
import site
|
||||
import logging
|
||||
import sysconfig
|
||||
|
||||
|
@ -15,9 +16,6 @@ from packaging.util import newer_group
|
|||
from packaging.compiler.extension import Extension
|
||||
from packaging import logger
|
||||
|
||||
import site
|
||||
HAS_USER_SITE = True
|
||||
|
||||
if os.name == 'nt':
|
||||
from packaging.compiler.msvccompiler import get_build_version
|
||||
MSVC_VERSION = int(get_build_version())
|
||||
|
@ -62,6 +60,8 @@ class build_ext(Command):
|
|||
('inplace', 'i',
|
||||
"ignore build-lib and put compiled extensions into the source " +
|
||||
"directory alongside your pure Python modules"),
|
||||
('user', None,
|
||||
"add user include, library and rpath"),
|
||||
('include-dirs=', 'I',
|
||||
"list of directories to search for header files" + sep_by),
|
||||
('define=', 'D',
|
||||
|
@ -88,12 +88,8 @@ class build_ext(Command):
|
|||
"path to the SWIG executable"),
|
||||
]
|
||||
|
||||
boolean_options = ['inplace', 'debug', 'force']
|
||||
boolean_options = ['inplace', 'debug', 'force', 'user']
|
||||
|
||||
if HAS_USER_SITE:
|
||||
user_options.append(('user', None,
|
||||
"add user include, library and rpath"))
|
||||
boolean_options.append('user')
|
||||
|
||||
help_options = [
|
||||
('help-compiler', None,
|
||||
|
@ -120,8 +116,7 @@ class build_ext(Command):
|
|||
self.compiler = None
|
||||
self.swig = None
|
||||
self.swig_opts = None
|
||||
if HAS_USER_SITE:
|
||||
self.user = None
|
||||
self.user = None
|
||||
|
||||
def finalize_options(self):
|
||||
self.set_undefined_options('build',
|
||||
|
@ -270,7 +265,7 @@ class build_ext(Command):
|
|||
self.swig_opts = self.swig_opts.split(' ')
|
||||
|
||||
# Finally add the user include and library directories if requested
|
||||
if HAS_USER_SITE and self.user:
|
||||
if self.user:
|
||||
user_include = os.path.join(site.USER_BASE, "include")
|
||||
user_lib = os.path.join(site.USER_BASE, "lib")
|
||||
if os.path.isdir(user_include):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue