summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Fernandez <xavier.fernandez@polyconseil.fr>2016-11-19 00:48:15 +0100
committerXavier Fernandez <xavier.fernandez@polyconseil.fr>2016-11-19 13:10:24 +0100
commit57319c10092b2a839ca665aecfdbf27361e48eda (patch)
tree6ce58b11f54cc4ad6968ac8550bb69933617002d
parentd64b871d97f64fa10ca5a3f390d14fb35d761390 (diff)
downloadpip-fix_script_names.tar.gz
Fix _script_names method on windowsfix_script_names
-rw-r--r--pip/req/req_install.py49
1 files changed, 25 insertions, 24 deletions
diff --git a/pip/req/req_install.py b/pip/req/req_install.py
index 435b4f8bb..d7e340176 100644
--- a/pip/req/req_install.py
+++ b/pip/req/req_install.py
@@ -69,6 +69,27 @@ def _safe_extras(extras):
return set(pkg_resources.safe_extra(extra) for extra in extras)
+def _script_names(dist, script_name, is_gui):
+ """Create the fully qualified name of the files created by
+ {console,gui}_scripts for the given ``dist``.
+ Returns the list of file names
+ """
+ if dist_in_usersite(dist):
+ bin_dir = bin_user
+ else:
+ bin_dir = bin_py
+ exe_name = os.path.join(bin_dir, script_name)
+ paths_to_remove = [exe_name]
+ if WINDOWS:
+ paths_to_remove.append(exe_name + '.exe')
+ paths_to_remove.append(exe_name + '.exe.manifest')
+ if is_gui:
+ paths_to_remove.append(exe_name + '-script.pyw')
+ else:
+ paths_to_remove.append(exe_name + '-script.py')
+ return paths_to_remove
+
+
class InstallRequirement(object):
def __init__(self, req, comes_from, source_dir=None, editable=False,
@@ -725,12 +746,12 @@ class InstallRequirement(object):
# find console_scripts
_scripts_to_remove = []
console_scripts = dist.get_entry_map(group='console_scripts')
- for name in console_scripts.keys():
- _scripts_to_remove.extend(self._script_names(dist, name, False))
+ for script_name in console_scripts.keys():
+ _scripts_to_remove.extend(_script_names(dist, script_name, False))
# find gui_scripts
gui_scripts = dist.get_entry_map(group='gui_scripts')
- for name in gui_scripts.keys():
- _scripts_to_remove.extend(self._script_names(dist, name, True))
+ for script_name in gui_scripts.keys():
+ _scripts_to_remove.extend(_script_names(dist, script_name, True))
for s in _scripts_to_remove:
paths_to_remove.add(s)
@@ -738,26 +759,6 @@ class InstallRequirement(object):
paths_to_remove.remove(auto_confirm)
self.uninstalled = paths_to_remove
- def _script_names(self, dist, name, is_gui):
- '''Create the fully qualified name of the files created by
- {console,gui}_scripts for the given ``dist``. Returns the list of file
- names'''
- if dist_in_usersite(dist):
- bin_dir = bin_user
- else:
- bin_dir = bin_py
- exe_name = os.path.join(bin_dir, name)
- paths_to_remove = [exe_name, ]
- if WINDOWS:
- paths_to_remove.add(exe_name + '.exe')
- paths_to_remove.add(exe_name + '.exe.manifest')
- if is_gui:
- paths_to_remove.add(exe_name + '-script.pyw')
- else:
- paths_to_remove.add(exe_name + '-script.py')
-
- return paths_to_remove
-
def rollback_uninstall(self):
if self.uninstalled:
self.uninstalled.rollback()