diff options
| author | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2020-12-31 17:50:15 +0100 |
|---|---|---|
| committer | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2020-12-31 18:38:48 +0100 |
| commit | 0d3b9600b2a94449796d06e3cea06c7a3972887b (patch) | |
| tree | 1455a7da775ed691ba656033d4c85a6a61a9c71e /setuptools/command | |
| parent | 02038f6272bd2fc04066480f7ba7d564ddb58769 (diff) | |
| download | python-setuptools-git-0d3b9600b2a94449796d06e3cea06c7a3972887b.tar.gz | |
Simplify `easy_install.install_eggs`
Diffstat (limited to 'setuptools/command')
| -rw-r--r-- | setuptools/command/easy_install.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 9ec83b7d..ff449435 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -837,12 +837,19 @@ class easy_install(Command): def install_eggs(self, spec, dist_filename, tmpdir): # .egg dirs or files are already built, so just return them - if dist_filename.lower().endswith('.egg'): - 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)] + installer_map = { + '.egg': self.install_egg, + '.exe': self.install_exe, + '.whl': self.install_wheel, + } + try: + install_dist = installer_map[ + dist_filename.lower()[-4:] + ] + except KeyError: + pass + else: + return [install_dist(dist_filename, tmpdir)] # Anything else, try to extract and build setup_base = tmpdir |
