diff options
Diffstat (limited to 'setuptools')
| -rwxr-xr-x | setuptools/command/easy_install.py | 7 | ||||
| -rw-r--r-- | setuptools/command/test.py | 2 | ||||
| -rw-r--r-- | setuptools/command/upload_docs.py | 12 | ||||
| -rw-r--r-- | setuptools/extension.py | 2 | ||||
| -rwxr-xr-x | setuptools/package_index.py | 14 | ||||
| -rwxr-xr-x | setuptools/sandbox.py | 2 | ||||
| -rw-r--r-- | setuptools/script template (dev).py | 5 | ||||
| -rw-r--r-- | setuptools/tests/__init__.py | 3 | ||||
| -rw-r--r-- | setuptools/tests/test_develop.py | 2 | ||||
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 1 |
10 files changed, 33 insertions, 17 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 731a4dc3..3194644e 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: 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([]): diff --git a/setuptools/extension.py b/setuptools/extension.py index eb8b836c..d7892d3d 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -35,7 +35,7 @@ class Extension(_Extension): if source.endswith('.pyx'): source = source[:-4] + '.c' return source - self.sources = map(pyx_to_c, self.sources) + self.sources = list(map(pyx_to_c, self.sources)) class Library(Extension): """Just like a regular Extension, but built as a library instead""" diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 99247ef1..61a66c6d 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -179,7 +179,7 @@ def find_external_links(url, page): for match in REL.finditer(page): tag, rel = match.groups() - rels = map(str.strip, rel.lower().split(',')) + rels = set(map(str.strip, rel.lower().split(','))) if 'homepage' in rels or 'download' in rels: for match in HREF.finditer(tag): yield urljoin(url, htmldecode(match.group(1))) @@ -699,7 +699,7 @@ class PackageIndex(Environment): elif scheme.startswith('hg+'): return self._download_hg(url, filename) elif scheme=='file': - return url2pathname(urlparse.urlparse(url)[2]) + return url2pathname(urlparse(url)[2]) else: self.url_ok(url, True) # raises error if not allowed return self._attempt_download(url, filename) @@ -749,10 +749,10 @@ class PackageIndex(Environment): url = url.split('#',1)[0] # remove any fragment for svn's sake creds = '' if url.lower().startswith('svn:') and '@' in url: - scheme, netloc, path, p, q, f = urlparse.urlparse(url) + scheme, netloc, path, p, q, f = urlparse(url) if not netloc and path.startswith('//') and '/' in path[2:]: netloc, path = path[2:].split('/',1) - auth, host = urllib.splituser(netloc) + auth, host = splituser(netloc) if auth: if ':' in auth: user, pw = auth.split(':',1) @@ -760,13 +760,13 @@ class PackageIndex(Environment): else: creds = " --username="+auth netloc = host - url = urlparse.urlunparse((scheme, netloc, url, p, q, f)) + url = urlunparse((scheme, netloc, url, p, q, f)) self.info("Doing subversion checkout from %s to %s", url, filename) os.system("svn checkout%s -q %s %s" % (creds, url, filename)) return filename def _vcs_split_rev_from_url(self, url, pop_prefix=False): - scheme, netloc, path, query, frag = urlparse.urlsplit(url) + scheme, netloc, path, query, frag = urlsplit(url) scheme = scheme.split('+', 1)[-1] @@ -778,7 +778,7 @@ class PackageIndex(Environment): path, rev = path.rsplit('@', 1) # Also, discard fragment - url = urlparse.urlunsplit((scheme, netloc, path, query, '')) + url = urlunsplit((scheme, netloc, path, query, '')) return url, rev diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 441cae01..4e527446 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -86,7 +86,7 @@ def run_setup(setup_script, args): # exclude any encodings modules. See #285 and not mod_name.startswith('encodings.') ] - map(sys.modules.__delitem__, del_modules) + list(map(sys.modules.__delitem__, del_modules)) os.chdir(old_dir) sys.path[:] = save_path sys.argv[:] = save_argv diff --git a/setuptools/script template (dev).py b/setuptools/script template (dev).py index 6dd9dd45..901790e7 100644 --- a/setuptools/script template (dev).py +++ b/setuptools/script template (dev).py @@ -3,4 +3,7 @@ __requires__ = """%(spec)r""" from pkg_resources import require; require("""%(spec)r""") del require __file__ = """%(dev_path)r""" -execfile(__file__) +try: + execfile(__file__) +except NameError: + exec(compile(open(__file__).read(), __file__, 'exec')) diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py index 298141a7..b5328ce6 100644 --- a/setuptools/tests/__init__.py +++ b/setuptools/tests/__init__.py @@ -2,7 +2,7 @@ import sys import os import unittest -import doctest +from setuptools.tests import doctest import distutils.core import distutils.cmd from distutils.errors import DistutilsOptionError, DistutilsPlatformError @@ -11,6 +11,7 @@ from distutils.core import Extension from distutils.version import LooseVersion from setuptools.compat import func_code +from setuptools.compat import func_code import setuptools.dist import setuptools.depends as dep from setuptools import Feature diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 9d7ce711..7b90161a 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -51,7 +51,7 @@ class TestDevelopTest(unittest.TestCase): site.USER_SITE = tempfile.mkdtemp() def tearDown(self): - if sys.version < "2.6" or hasattr(sys, 'real_prefix'): + if sys.version < "2.6" or hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix): return os.chdir(self.old_cwd) diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 277b4844..b0609eb1 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -12,6 +12,7 @@ import textwrap import tarfile import distutils.core +from setuptools.compat import StringIO, BytesIO, next, urlparse from setuptools.sandbox import run_setup, SandboxViolation from setuptools.command.easy_install import easy_install, fix_jython_executable, get_script_args from setuptools.command.easy_install import PthDistributions |
