-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP prototype pep517-style editable #8154
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
install_editable as install_editable_legacy | ||
from pip._internal.operations.install.legacy import LegacyInstallFailure | ||
from pip._internal.operations.install.legacy import install as install_legacy | ||
from pip._internal.operations.install.wheel import install_wheel | ||
from pip._internal.operations.install.wheel import install_wheel, install_unpacked_parsed_wheel | ||
from pip._internal.pyproject import load_pyproject_toml, make_pyproject_path | ||
from pip._internal.req.req_uninstall import UninstallPathSet | ||
from pip._internal.utils.deprecation import deprecated | ||
|
@@ -777,18 +777,47 @@ def install( | |
|
||
global_options = global_options if global_options is not None else [] | ||
if self.editable: | ||
install_editable_legacy( | ||
install_options, | ||
global_options, | ||
prefix=prefix, | ||
home=home, | ||
use_user_site=use_user_site, | ||
name=self.name, | ||
setup_py_path=self.setup_py_path, | ||
isolated=self.isolated, | ||
build_env=self.build_env, | ||
unpacked_source_directory=self.unpacked_source_directory, | ||
) | ||
if self.metadata_directory and self.metadata_directory.endswith('.dist-info'): | ||
|
||
editable_path = self.pep517_backend.build_editable() | ||
|
||
# create empty RECORD | ||
with open(os.path.join(self.metadata_directory, 'RECORD'), 'w+'): | ||
pass | ||
|
||
wheeldir = os.path.dirname(self.metadata_directory) | ||
|
||
# put .pth file in wheeldir | ||
with open(os.path.join(wheeldir, self.name + '.pth'), 'w+') as pthfile: | ||
pthfile.write(editable_path['src_root'] + '\n') | ||
dholth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
install_unpacked_parsed_wheel( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the need for this. Why can't the backend just provide a wheel, which we install using the normal There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only the easiest way to copy files into site-packages with pip. Remember the older PEP 376 concept which is a directory with a *.dist-info. That concept also appears in the PEP 517 metadata hook. An unhappy accident that the *.data/ directory would technically work? If it was a complete wheel it would be a strange one that only worked on this machine and shared the name of the package but not its contents. It would be a hassle to re-implement bdist_wheel in the develop command class, or to create an ephemeral ZipFile and compute RECORD in another build system. As for pip that function should be broken up even without editable installs. It has a TODO. I've split out the only part that requires a ZipFile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I notice that this doesn't populate RECORD when it's installed. Thought that was happening before, but maybe not. |
||
self.name, | ||
wheeldir, | ||
self.metadata_directory, | ||
{ | ||
"Root-Is-Purelib" : "false", # shouldn't matter | ||
}, | ||
scheme=scheme, | ||
req_description=str(self.req), | ||
pycompile=pycompile, | ||
warn_script_location=warn_script_location, | ||
direct_url=None, | ||
) | ||
|
||
else: | ||
install_editable_legacy( | ||
install_options, | ||
global_options, | ||
prefix=prefix, | ||
home=home, | ||
use_user_site=use_user_site, | ||
name=self.name, | ||
setup_py_path=self.setup_py_path, | ||
isolated=self.isolated, | ||
build_env=self.build_env, | ||
unpacked_source_directory=self.unpacked_source_directory, | ||
) | ||
self.install_succeeded = True | ||
return | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I think this should become
if self.editable and not self.is_wheel
then legacy editable install, else go ahead and install wheel with the regularinstall_wheel()
below, no other change necessary in this function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have to decide if this prototype makes sense or if it is just the way pip works. The prototyped approach is to put extra files into the directory into which we have already generated our
*.dist-info
directory as part of another hook. It's not quite a wheel. It's not necessarily easy for the build system, accustomed to building a regular wheel, to build a completely different kind of wheel. Stub modules in place of the regular contents, no need for compatibility tags, wheel caching, *.data directories, or the RECORD associated with a full wheel.