Description
What's the problem this feature will solve?
Currently, pip install .
command cannnot handle the relative path from Cargo.toml
which is used in setup-tools-rust
. Because installing from pip
requires to copy the whole package to temporary directory and it breaks relative path link.
Installing the package through python setup.py install
works completely. But trying to work with poetry requires to use pip. So I need some way to cope with the problem.
This issue might be related to PyO3/maturin#330.
Describe the solution you'd like
Want an option to use the original directory to install a python package not to use a temporary directory.
Alternative Solutions
Maybe an option to set current path to install package. But current --root
option does not work.
Additional context
I modified the function _prepare_linked_requirement
in pip/_internal/operations/prepare.py
and the install was completed.
def _prepare_linked_requirement(self, req, parallel_builds):
# type: (InstallRequirement, bool) -> Distribution
assert req.link
link = req.link
self._ensure_link_req_src_dir(req, parallel_builds)
hashes = self._get_linked_req_hashes(req)
if link.url not in self._downloaded:
try:
if not link.is_existing_dir():
local_file = unpack_url(
link, req.source_dir, self._download,
self.download_dir, hashes,
)
else:
req.source_dir = link.file_path
local_file = None
except NetworkConnectionError as exc:
raise InstallationError(
'Could not install requirement {} because of HTTP '
'error {} for URL {}'.format(req, exc, link)
)
else:
file_path, content_type = self._downloaded[link.url]
if hashes:
hashes.check_against_path(file_path)
local_file = File(file_path, content_type)
# For use in later processing,
# preserve the file path on the requirement.
if local_file:
req.local_file_path = local_file.path
dist = _get_prepared_distribution(
req, self.req_tracker, self.finder, self.build_isolation,
)
return dist