You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
4.1 KiB
96 lines
4.1 KiB
7 years ago
|
diff -up pip-9.0.1/pip/commands/install.py.orig pip-9.0.1/pip/commands/install.py
|
||
|
--- pip-9.0.1/pip/commands/install.py.orig 2016-11-06 11:49:45.000000000 -0700
|
||
|
+++ pip-9.0.1/pip/commands/install.py 2016-11-16 16:20:48.638906543 -0700
|
||
|
@@ -151,6 +151,14 @@ class InstallCommand(RequirementCommand)
|
||
|
"directory.")
|
||
|
|
||
|
cmd_opts.add_option(
|
||
|
+ '--strip-file-prefix',
|
||
|
+ dest='strip_file_prefix',
|
||
|
+ metavar='prefix',
|
||
|
+ default=None,
|
||
|
+ help="Strip given prefix from script paths in wheel RECORD."
|
||
|
+ )
|
||
|
+
|
||
|
+ cmd_opts.add_option(
|
||
|
'--prefix',
|
||
|
dest='prefix_path',
|
||
|
metavar='dir',
|
||
|
@@ -340,6 +348,7 @@ class InstallCommand(RequirementCommand)
|
||
|
global_options,
|
||
|
root=options.root_path,
|
||
|
prefix=options.prefix_path,
|
||
|
+ strip_file_prefix=options.strip_file_prefix,
|
||
|
)
|
||
|
|
||
|
possible_lib_locations = get_lib_location_guesses(
|
||
|
diff -up pip-9.0.1/pip/req/req_install.py.orig pip-9.0.1/pip/req/req_install.py
|
||
|
--- pip-9.0.1/pip/req/req_install.py.orig 2016-11-06 11:49:45.000000000 -0700
|
||
|
+++ pip-9.0.1/pip/req/req_install.py 2016-11-16 16:19:24.848336960 -0700
|
||
|
@@ -838,8 +838,7 @@ class InstallRequirement(object):
|
||
|
else:
|
||
|
return True
|
||
|
|
||
|
- def install(self, install_options, global_options=[], root=None,
|
||
|
- prefix=None):
|
||
|
+ def install(self, install_options, global_options=[], root=None, prefix=None, strip_file_prefix=None):
|
||
|
if self.editable:
|
||
|
self.install_editable(
|
||
|
install_options, global_options, prefix=prefix)
|
||
|
@@ -848,7 +847,12 @@ class InstallRequirement(object):
|
||
|
version = pip.wheel.wheel_version(self.source_dir)
|
||
|
pip.wheel.check_compatibility(version, self.name)
|
||
|
|
||
|
- self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
|
||
|
+ self.move_wheel_files(
|
||
|
+ self.source_dir,
|
||
|
+ root=root,
|
||
|
+ prefix=prefix,
|
||
|
+ strip_file_prefix=strip_file_prefix
|
||
|
+ )
|
||
|
self.install_succeeded = True
|
||
|
return
|
||
|
|
||
|
@@ -1053,7 +1057,7 @@ class InstallRequirement(object):
|
||
|
def is_wheel(self):
|
||
|
return self.link and self.link.is_wheel
|
||
|
|
||
|
- def move_wheel_files(self, wheeldir, root=None, prefix=None):
|
||
|
+ def move_wheel_files(self, wheeldir, root=None, prefix=None, strip_file_prefix=None):
|
||
|
move_wheel_files(
|
||
|
self.name, self.req, wheeldir,
|
||
|
user=self.use_user_site,
|
||
|
@@ -1062,6 +1066,7 @@ class InstallRequirement(object):
|
||
|
prefix=prefix,
|
||
|
pycompile=self.pycompile,
|
||
|
isolated=self.isolated,
|
||
|
+ strip_file_prefix=strip_file_prefix,
|
||
|
)
|
||
|
|
||
|
def get_dist(self):
|
||
|
diff -up pip-9.0.1/pip/wheel.py.orig pip-9.0.1/pip/wheel.py
|
||
|
--- pip-9.0.1/pip/wheel.py.orig 2016-11-06 11:49:45.000000000 -0700
|
||
|
+++ pip-9.0.1/pip/wheel.py 2016-11-16 16:19:24.848336960 -0700
|
||
|
@@ -238,7 +238,7 @@ def get_entrypoints(filename):
|
||
|
|
||
|
|
||
|
def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
|
||
|
- pycompile=True, scheme=None, isolated=False, prefix=None):
|
||
|
+ pycompile=True, scheme=None, isolated=False, prefix=None, strip_file_prefix=None):
|
||
|
"""Install a wheel"""
|
||
|
|
||
|
if not scheme:
|
||
|
@@ -521,7 +521,11 @@ if __name__ == '__main__':
|
||
|
writer.writerow(row)
|
||
|
for f in generated:
|
||
|
h, l = rehash(f)
|
||
|
- writer.writerow((normpath(f, lib_dir), h, l))
|
||
|
+ final_path = normpath(f, lib_dir)
|
||
|
+ if strip_file_prefix and final_path.startswith(strip_file_prefix):
|
||
|
+ final_path = os.path.join(os.sep,
|
||
|
+ os.path.relpath(final_path, strip_file_prefix))
|
||
|
+ writer.writerow((final_path, h, l))
|
||
|
for f in installed:
|
||
|
writer.writerow((installed[f], '', ''))
|
||
|
shutil.move(temp_record, record)
|