mirror of https://github.com/pypa/pip
Merge f7c56bc308
into 9f213bf69a
This commit is contained in:
commit
e61549e9d0
|
@ -0,0 +1 @@
|
|||
New pip install option ``--executable=/path`` to set #! path in scripts.
|
|
@ -141,6 +141,14 @@ class InstallCommand(RequirementCommand):
|
|||
"environment."
|
||||
),
|
||||
)
|
||||
self.cmd_opts.add_option(
|
||||
"--executable",
|
||||
dest="executable_path",
|
||||
default=None,
|
||||
help=(
|
||||
"Path to executable for #! lines in scripts."
|
||||
),
|
||||
)
|
||||
|
||||
self.cmd_opts.add_option(cmdoptions.src())
|
||||
|
||||
|
@ -455,6 +463,7 @@ class InstallCommand(RequirementCommand):
|
|||
root=options.root_path,
|
||||
home=target_temp_dir_path,
|
||||
prefix=options.prefix_path,
|
||||
executable=options.executable_path,
|
||||
warn_script_location=warn_script_location,
|
||||
use_user_site=options.use_user_site,
|
||||
pycompile=options.compile,
|
||||
|
|
|
@ -422,6 +422,9 @@ def _raise_for_invalid_entrypoint(specification: str) -> None:
|
|||
|
||||
|
||||
class PipScriptMaker(ScriptMaker):
|
||||
def __init__(self, executable, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.executable = executable
|
||||
def make(
|
||||
self, specification: str, options: Optional[Dict[str, Any]] = None
|
||||
) -> List[str]:
|
||||
|
@ -434,6 +437,7 @@ def _install_wheel(
|
|||
wheel_zip: ZipFile,
|
||||
wheel_path: str,
|
||||
scheme: Scheme,
|
||||
executable: Optional[str] = None,
|
||||
pycompile: bool = True,
|
||||
warn_script_location: bool = True,
|
||||
direct_url: Optional[DirectUrl] = None,
|
||||
|
@ -624,7 +628,7 @@ def _install_wheel(
|
|||
record_installed(pyc_record_path, pyc_path)
|
||||
logger.debug(stdout.getvalue())
|
||||
|
||||
maker = PipScriptMaker(None, scheme.scripts)
|
||||
maker = PipScriptMaker(executable, None, scheme.scripts)
|
||||
|
||||
# Ensure old scripts are overwritten.
|
||||
# See https://github.com/pypa/pip/issues/1800
|
||||
|
@ -721,6 +725,7 @@ def install_wheel(
|
|||
wheel_path: str,
|
||||
scheme: Scheme,
|
||||
req_description: str,
|
||||
executable: Optional[str] = None,
|
||||
pycompile: bool = True,
|
||||
warn_script_location: bool = True,
|
||||
direct_url: Optional[DirectUrl] = None,
|
||||
|
@ -733,6 +738,7 @@ def install_wheel(
|
|||
wheel_zip=z,
|
||||
wheel_path=wheel_path,
|
||||
scheme=scheme,
|
||||
executable=executable,
|
||||
pycompile=pycompile,
|
||||
warn_script_location=warn_script_location,
|
||||
direct_url=direct_url,
|
||||
|
|
|
@ -40,6 +40,7 @@ def install_given_reqs(
|
|||
root: Optional[str],
|
||||
home: Optional[str],
|
||||
prefix: Optional[str],
|
||||
executable: Optional[str],
|
||||
warn_script_location: bool,
|
||||
use_user_site: bool,
|
||||
pycompile: bool,
|
||||
|
@ -74,6 +75,7 @@ def install_given_reqs(
|
|||
root=root,
|
||||
home=home,
|
||||
prefix=prefix,
|
||||
executable=executable,
|
||||
warn_script_location=warn_script_location,
|
||||
use_user_site=use_user_site,
|
||||
pycompile=pycompile,
|
||||
|
|
|
@ -812,6 +812,7 @@ class InstallRequirement:
|
|||
root: Optional[str] = None,
|
||||
home: Optional[str] = None,
|
||||
prefix: Optional[str] = None,
|
||||
executable: Optional[str] = None,
|
||||
warn_script_location: bool = True,
|
||||
use_user_site: bool = False,
|
||||
pycompile: bool = True,
|
||||
|
@ -848,6 +849,7 @@ class InstallRequirement:
|
|||
self.req.name,
|
||||
self.local_file_path,
|
||||
scheme=scheme,
|
||||
executable=executable,
|
||||
req_description=str(self.req),
|
||||
pycompile=pycompile,
|
||||
warn_script_location=warn_script_location,
|
||||
|
|
Loading…
Reference in New Issue