diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2018-01-04 20:42:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-04 20:42:12 -0500 |
| commit | c0edf9323c1e124ae34f96ccfb7cf21df0f32252 (patch) | |
| tree | 3e2c19e8371c90d3c0d7fbfb6d8122e47def47de /setuptools/command/easy_install.py | |
| parent | 7af7f8a68ea4b0f7d45a739273684832fa609935 (diff) | |
| parent | 85747b8ccc2a2da7ecb59c6aff2561c052c463d2 (diff) | |
| download | python-setuptools-git-c0edf9323c1e124ae34f96ccfb7cf21df0f32252.tar.gz | |
Merge branch 'master' into master
Diffstat (limited to 'setuptools/command/easy_install.py')
| -rwxr-xr-x | setuptools/command/easy_install.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 71991efa..12e22310 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -53,6 +53,7 @@ from setuptools.package_index import ( PackageIndex, parse_requirement_arg, URL_SCHEME, ) from setuptools.command import bdist_egg, egg_info +from setuptools.wheel import Wheel from pkg_resources import ( yield_lines, normalize_path, resource_string, ensure_directory, get_distribution, find_distributions, Environment, Requirement, @@ -842,6 +843,8 @@ class easy_install(Command): return [self.install_egg(dist_filename, tmpdir)] elif dist_filename.lower().endswith('.exe'): return [self.install_exe(dist_filename, tmpdir)] + elif dist_filename.lower().endswith('.whl'): + return [self.install_wheel(dist_filename, tmpdir)] # Anything else, try to extract and build setup_base = tmpdir @@ -1038,6 +1041,35 @@ class easy_install(Command): f.write('\n'.join(locals()[name]) + '\n') f.close() + def install_wheel(self, wheel_path, tmpdir): + wheel = Wheel(wheel_path) + assert wheel.is_compatible() + destination = os.path.join(self.install_dir, wheel.egg_name()) + destination = os.path.abspath(destination) + if not self.dry_run: + ensure_directory(destination) + if os.path.isdir(destination) and not os.path.islink(destination): + dir_util.remove_tree(destination, dry_run=self.dry_run) + elif os.path.exists(destination): + self.execute( + os.unlink, + (destination,), + "Removing " + destination, + ) + try: + self.execute( + wheel.install_as_egg, + (destination,), + ("Installing %s to %s") % ( + os.path.basename(wheel_path), + os.path.dirname(destination) + ), + ) + finally: + update_dist_caches(destination, fix_zipimporter_caches=False) + self.add_output(destination) + return self.egg_distribution(destination) + __mv_warning = textwrap.dedent(""" Because this distribution was installed --multi-version, before you can import modules from this package in an application, you will need to |
