-
Notifications
You must be signed in to change notification settings - Fork 18
Ensure python_wheel sources are linked after dependent targets are built #308
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
Open
marcuscaisey
wants to merge
2
commits into
please-build:master
Choose a base branch
from
marcuscaisey:wheel-symlink
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -513,8 +513,8 @@ def pip_library(name:str, version:str, labels:list=[], hashes:list=None, package | |
| labels = ["dlink:plz-out/python/venv"] | ||
| ) | ||
|
|
||
| # Don't include the dependency whl's into our whl. They are later picked up by py_binary anyway. | ||
| cmd = f'$TOOLS_ARCAT z --suffix="" --exclude_suffix=whl --include_other -i . -r $PKG/{name}:$PKG' | ||
| # Don't include the dependency pex.zips or whls into our whl. They are later picked up by python_binary anyway. | ||
| cmd = f'$TOOLS_ARCAT z --suffix="" --exclude_suffix=whl --exclude_suffix=pex.zip --include_other -i . -r $PKG/{name}:$PKG' | ||
| if not licences: | ||
| cmd += ' && find . -name METADATA -or -name PKG-INFO | grep -v "^./build/" | xargs grep -E "License ?:" | grep -v UNKNOWN | cat || true' | ||
|
|
||
|
|
@@ -531,6 +531,7 @@ def pip_library(name:str, version:str, labels:list=[], hashes:list=None, package | |
| tools = { | ||
| 'arcat': [CONFIG.ARCAT_TOOL], | ||
| }, | ||
| requires = ["py"], | ||
| post_build = None if licences else _add_licences, | ||
| labels = labels + ['py', 'pip:' + package_name] + (['py:zip-unsafe'] if not zip_safe else []), | ||
| visibility = visibility, | ||
|
|
@@ -667,51 +668,52 @@ def python_wheel(name:str, version:str, labels:list=[], hashes:list=None, packag | |
| cmd += [ | ||
| # N.B. we need -b for legacy locations because that's all zipimport knows to look for :( | ||
| '$TOOLS_PYTHON -m compileall -b -f .', | ||
| '$TOOLS_ARCAT z -d --prefix $PKG -i ' + ' -i '.join(outs or [name]), | ||
| ] | ||
| label = f'whl:{package_name}=={version}' | ||
|
|
||
| wheel_rule = build_rule( | ||
| srcs_rule = build_rule( | ||
| name = name, | ||
| tag = 'wheel', | ||
| tag = 'srcs', | ||
| cmd = ' && '.join(cmd), | ||
| outs = [name + '.pex.zip'], | ||
| outs = outs or [name], | ||
| srcs = { | ||
| 'src': [file_rule], | ||
| 'res': patches if patch else [], | ||
| }, | ||
| building_description = 'Repackaging...', | ||
| requires = ['py'], | ||
| deps = deps, | ||
| building_description = 'Extracting...', | ||
| test_only = test_only, | ||
| licences = licences, | ||
| tools = { | ||
| "arcat": [CONFIG.ARCAT_TOOL], | ||
| "python": [interpreter], | ||
| }, | ||
| post_build = None if licences else _add_licences, | ||
| sandbox = False, | ||
| labels = [label] + ["link:plz-out/python/venv"], | ||
| ) | ||
|
|
||
| wheel_rule = build_rule( | ||
| name = name, | ||
| tag = 'wheel', | ||
| cmd = '$TOOL z -d -i $PKG/' + ' -i $PKG/'.join(outs or [name]), | ||
| outs = [name + '.pex.zip'], | ||
| srcs = [srcs_rule], | ||
| building_description = 'Repackaging...', | ||
| requires = ['py'], | ||
| deps = deps, | ||
| test_only = test_only, | ||
| tools = [CONFIG.ARCAT_TOOL], | ||
| labels = ['py:zip-unsafe', label] if not zip_safe else [label], | ||
| ) | ||
| cmd = '$TOOL x $SRCS -s $PKG_DIR' | ||
| if outs: | ||
| # Hacky solution to handle things being in subdirectories in awkward ways. | ||
| before, _, after = outs[0].partition('/') | ||
| if after: | ||
| cmd = f'rm -rf {before} && {cmd}' | ||
|
Contributor
Author
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 think this logic was trying to handle the scenario where the sources are output into the same directory as one of the deps. The |
||
|
|
||
| lib_rule = build_rule( | ||
|
|
||
| lib_rule = filegroup( | ||
| name = name, | ||
| tag = "lib_rule" if binary else None, | ||
| srcs = [wheel_rule], | ||
| outs = outs or [name], | ||
| tools = [CONFIG.ARCAT_TOOL], | ||
| cmd = cmd, | ||
| srcs = [srcs_rule], | ||
| deps = deps, | ||
| visibility = visibility, | ||
| licences = licences, | ||
| test_only = test_only, | ||
| labels = labels + [label] + ["link:plz-out/python/venv"], | ||
| labels = labels + [label], | ||
| provides = { | ||
| "py": wheel_rule, | ||
| "py_whl": file_rule, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This was never needed since the build doesn't make any network requests