diff options
Diffstat (limited to 'setuptools/command')
| -rwxr-xr-x | setuptools/command/easy_install.py | 8 | ||||
| -rwxr-xr-x | setuptools/command/egg_info.py | 6 | ||||
| -rwxr-xr-x | setuptools/command/install_egg_info.py | 1 | ||||
| -rw-r--r-- | setuptools/command/test.py | 2 | ||||
| -rw-r--r-- | setuptools/command/upload_docs.py | 12 |
5 files changed, 20 insertions, 9 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 731a4dc3..000fefa0 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -58,7 +58,10 @@ from pkg_resources import yield_lines, normalize_path, resource_string, \ DistributionNotFound, VersionConflict, \ DEVELOP_DIST -sys_executable = os.path.normpath(sys.executable) +if '__VENV_LAUNCHER__' in os.environ: + sys_executable = os.environ['__VENV_LAUNCHER__'] +else: + sys_executable = os.path.normpath(sys.executable) __all__ = [ 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', @@ -282,6 +285,8 @@ class easy_install(Command): self.script_dir = self.install_scripts # default --record from the install command self.set_undefined_options('install', ('record', 'record')) + # Should this be moved to the if statement below? It's not used + # elsewhere normpath = map(normalize_path, sys.path) self.all_site_dirs = get_site_dirs() if self.site_dirs is not None: @@ -1486,7 +1491,6 @@ def extract_wininst_cfg(dist_filename): f.seek(prepended-12) from setuptools.compat import StringIO, ConfigParser - import struct tag, cfglen, bmlen = struct.unpack("<iii",f.read(12)) if tag not in (0x1234567A, 0x1234567B): return None # not a valid tag diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index ae14bb54..6b0d2426 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -235,7 +235,7 @@ class egg_info(Command): log.warn("unrecognized .svn/entries format; skipping %s", base) dirs[:] = [] continue - + data = list(map(str.splitlines,data.split('\n\x0c\n'))) del data[0][0] # get rid of the '8' or '9' or '10' dirurl = data[0][3] @@ -283,7 +283,7 @@ class FileList(_FileList): item = item[:-1] path = convert_path(item) - if sys.version_info >= (3,): + if PY3: try: if os.path.exists(path) or os.path.exists(path.encode('utf-8')): self.files.append(path) @@ -337,7 +337,7 @@ class manifest_maker(sdist): named by 'self.manifest'. """ # The manifest must be UTF-8 encodable. See #303. - if sys.version_info >= (3,): + if PY3: files = [] for file in self.filelist.files: try: diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py index f44b34b5..87ddff9c 100755 --- a/setuptools/command/install_egg_info.py +++ b/setuptools/command/install_egg_info.py @@ -1,5 +1,6 @@ from setuptools import Command from setuptools.archive_util import unpack_archive +from setuptools.compat import PY3 from distutils import log, dir_util import os, shutil, pkg_resources diff --git a/setuptools/command/test.py b/setuptools/command/test.py index a02ac142..db2fc7b1 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -154,7 +154,7 @@ class test(Command): for name in sys.modules: if name.startswith(module): del_modules.append(name) - map(sys.modules.__delitem__, del_modules) + list(map(sys.modules.__delitem__, del_modules)) loader_ep = EntryPoint.parse("x="+self.test_loader) loader_class = loader_ep.load(require=False) diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index a75c3b7e..12bc916b 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -23,15 +23,21 @@ try: except ImportError: from setuptools.command.upload import upload -from setuptools.compat import httplib, urlparse +from setuptools.compat import httplib, urlparse, unicode, iteritems _IS_PYTHON3 = sys.version > '3' +if _IS_PYTHON3: + errors = 'surrogateescape' +else: + errors = 'strict' + + # This is not just a replacement for byte literals # but works as a general purpose encoder def b(s, encoding='utf-8'): if isinstance(s, unicode): - return s.encode(encoding) + return s.encode(encoding, errors) return s @@ -127,7 +133,7 @@ class upload_docs(upload): sep_boundary = b('\n--') + b(boundary) end_boundary = sep_boundary + b('--') body = [] - for key, values in data.iteritems(): + for key, values in iteritems(data): title = '\nContent-Disposition: form-data; name="%s"' % key # handle multiple entries for the same name if type(values) != type([]): |
