Skip to content
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

Expose the ability to add a local wheel through the CLI. #1038

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pex/bin/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,18 @@ def configure_clp():
" This option can be used multiple times.",
)

parser.add_option(
"-w",
"--wheel-dist",
dest="wheel_dists",
metavar="FILE",
default=[],
type=str,
action="append",
help="Add a wheel distribution (.whl) from a local path into the generated .pex file."
" This option can be used multiple times.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be helpful to explain more about the expectation. Can this be a .whl file, or it should be an expanded folder?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relative path or absolute path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fact that the metavar says it should be a file is enough to distinguish that it isn't an expanded folder, and the fact that the .whl suffix is suggested. I'll make a change to indicate it can be relative or absolute, and to canonicalize any relative paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the PEXBuilder.add_dist_location method that does the work here already deals with relative paths. I'll change the comment.

)

parser.add_option(
"-R",
"--resources-directory",
Expand Down Expand Up @@ -854,6 +866,9 @@ def walk_and_do(fn, src_dir):
for requirements_pex in options.requirements_pexes:
pex_builder.add_from_requirements_pex(requirements_pex)

for whl_path in options.wheel_dists:
pex_builder.add_dist_location(whl_path)

with TRACER.timed("Resolving distributions ({})".format(reqs + options.requirement_files)):
network_configuration = NetworkConfiguration.create(
cache_ttl=options.cache_ttl,
Expand Down