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

Fix handling of pre-release option. #424

Merged
merged 1 commit into from
Oct 11, 2017

Conversation

zvezdan
Copy link
Contributor

@zvezdan zvezdan commented Oct 10, 2017

Pex takes a --pre option from the command line, but it does not pass
it correctly during build. We need to propagate it to resolver to get
the correct behavior.

Fixes #423

@zvezdan
Copy link
Contributor Author

zvezdan commented Oct 10, 2017

Can someone please re-run the jobs.
Only PyPy and Python 3.4 jobs failed.
Python 3.4 practically did not start, while PyPy job failed in a way that does not seem related to this change.
Both of these jobs have this info at the top of the log:

This job ran on our Precise environment, which is in the process of being decommissioned.
Please read about the status of the rollout on the blog, and take note that you can
explicitly stay on Precise by specifying dist: precise in your .travis.yml.

Since all other language versions are passing I think that re-run or fix of Travis configuration may enable this change to pass the tests completely. Before submitting this PR, I tested with tox and tests for 2.7, 3.6, style, and isort all passed in my local environment. I do not have 3.4 or PyPy to test.

Copy link
Contributor

@kwlzn kwlzn left a comment

Choose a reason for hiding this comment

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

lgtm. thanks for the PR.

pex/bin/pex.py Outdated
@@ -565,7 +565,8 @@ def build_pex(args, options, resolver_option_builder):
interpreters=interpreters,
platforms=options.platform,
cache=options.cache_dir,
cache_ttl=options.cache_ttl)
cache_ttl=options.cache_ttl,
allow_prereleases=resolver_option_builder._allow_prereleases)
Copy link
Contributor

@kwlzn kwlzn Oct 10, 2017

Choose a reason for hiding this comment

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

actually, one quick ask: this access of _allow_prereleases violates the private convention. would you mind exposing _allow_prereleases here as a public attribute of the ResolverOptionsBuilder class and using that instead? a quick @property def allow_prereleases(self): return self._allow_prereleases would work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. That's easy. The only reason I did not do it initially is because I did not know what would be the code owner's preferences. I'll do it and resubmit.

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, I just realized that there was another reason. The existing method:

  def allow_prereleases(self, allowed):
    self._allow_prereleases = allowed
    return self

is not exactly a property setter, because it returns self.
I'll try to work around the existing interface and see what feels the best.

Pex takes a `--pre` option from the command line, but it does not pass
it correctly during build. We need to propagate it to resolver to get
the correct behavior.

Fixes pex-tool#423
@zvezdan
Copy link
Contributor Author

zvezdan commented Oct 11, 2017

@kwlzn I added the change and the comment describing why the property has a different name/API to-do note. If you feel I should take any of the new comments out of the patch, please let me know.
Also, if you feel the name should be different, I'd be glad to adapt to code owner's preferences.
Thanks for the quick review!

@kwlzn kwlzn merged commit 0a7296e into pex-tool:master Oct 11, 2017
@kwlzn
Copy link
Contributor

kwlzn commented Oct 11, 2017

@zvezdan thanks - merged.

@kwlzn kwlzn mentioned this pull request Oct 11, 2017
@zvezdan zvezdan deleted the fix-prerelease-handling branch October 12, 2017 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The --pre option is not passed from command-line options down to API call
2 participants