diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2016-05-18 19:57:23 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-05-18 19:57:23 -0400 |
| commit | c98abcb08a80ea84a6350f8901a4a3ea709c15f0 (patch) | |
| tree | 97972a5ebb507f2ea73681f1e6b1cde3542b542e /setuptools/command/easy_install.py | |
| parent | 1b66f61563f7835d7b5a29dc5413bd482ef4910d (diff) | |
| parent | 41d0279e41eaa5bc948bd7d6b815212e8d99e1fc (diff) | |
| download | python-setuptools-git-c98abcb08a80ea84a6350f8901a4a3ea709c15f0.tar.gz | |
Merge with master to fix failing tests
Diffstat (limited to 'setuptools/command/easy_install.py')
| -rwxr-xr-x | setuptools/command/easy_install.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 46056173..ea5cb028 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -710,10 +710,7 @@ class easy_install(Command): elif requirement is None or dist not in requirement: # if we wound up with a different version, resolve what we've got distreq = dist.as_requirement() - requirement = requirement or distreq - requirement = Requirement( - distreq.project_name, distreq.specs, requirement.extras - ) + requirement = Requirement(str(distreq)) log.info("Processing dependencies for %s", requirement) try: distros = WorkingSet([]).resolve( @@ -783,7 +780,7 @@ class easy_install(Command): There are a couple of template scripts in the package. This function loads one of them and prepares it for use. """ - # See https://bitbucket.org/pypa/setuptools/issue/134 for info + # See https://github.com/pypa/setuptools/issues/134 for info # on script file naming and downstream issues with SVR4 name = 'script.tmpl' if dev_path: @@ -1239,17 +1236,14 @@ class easy_install(Command): sitepy = os.path.join(self.install_dir, "site.py") source = resource_string("setuptools", "site-patch.py") + source = source.decode('utf-8') current = "" if os.path.exists(sitepy): log.debug("Checking existing site.py in %s", self.install_dir) - f = open(sitepy, 'rb') - current = f.read() - # we want str, not bytes - if six.PY3: - current = current.decode() + with io.open(sitepy) as strm: + current = strm.read() - f.close() if not current.startswith('def __boot():'): raise DistutilsError( "%s is not a setuptools-generated site.py; please" @@ -1260,9 +1254,8 @@ class easy_install(Command): log.info("Creating %s", sitepy) if not self.dry_run: ensure_directory(sitepy) - f = open(sitepy, 'wb') - f.write(source) - f.close() + with io.open(sitepy, 'w', encoding='utf-8') as strm: + strm.write(source) self.byte_compile([sitepy]) self.sitepy_installed = True @@ -1769,7 +1762,7 @@ def _update_zipimporter_cache(normalized_path, cache, updater=None): # * Does not support the dict.pop() method, forcing us to use the # get/del patterns instead. For more detailed information see the # following links: - # https://bitbucket.org/pypa/setuptools/issue/202/more-robust-zipimporter-cache-invalidation#comment-10495960 + # https://github.com/pypa/setuptools/issues/202#issuecomment-202913420 # https://bitbucket.org/pypy/pypy/src/dd07756a34a41f674c0cacfbc8ae1d4cc9ea2ae4/pypy/module/zipimport/interp_zipimport.py#cl-99 old_entry = cache[p] del cache[p] |
