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

Fixes to get pex to work on windows. #198

Merged
merged 2 commits into from
Jan 20, 2016
Merged

Conversation

mikekap
Copy link
Contributor

@mikekap mikekap commented Jan 12, 2016

The fixes are:

  • os.link doesn't exist on windows. Always copy instead.
  • NamedTemporaryFile doesn't work correctly on windows (see https://bugs.python.org/issue14243)
  • sys.prefix is part of site.getsitepackages() on windows. Don't remove it.

if e.errno == errno.EEXIST:
# File already exists. If overwrite=True, write otherwise skip.
if overwrite:
if hasattr(os, 'link'):
Copy link
Contributor

Choose a reason for hiding this comment

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

how about a quick comment here to indicate the reason for doing this (i.e. windows) so that a casual observer doesn't get confused by the otherwise odd hasattr check here.

@kwlzn
Copy link
Contributor

kwlzn commented Jan 12, 2016

lgtm overall mod a few comments. also, test coverage simulating windows environmental conditions (+ a quick unit test for named_temporary_file?) would be ideal.

@mikekap
Copy link
Contributor Author

mikekap commented Jan 12, 2016

Might it be better to set up windows CI (e.g. Appveyor) to make sure this works? Unfortunately I don't think there are currently tests for _site_libs other than integration tests.

@kwlzn
Copy link
Contributor

kwlzn commented Jan 13, 2016

generally speaking, pex doesn't claim or strongly desire windows support - my understanding is that it's essentially "best effort" via submission of PRs from interested contributors. with this said, I'm not sure it makes sense for us to add Appveyor at the moment without a stronger sense of ongoing Windows support ownership - hence the suggestion to simply mock out some of the windows conditions in test.

The fixes are:
 - os.link doesn't exist on windows. Always copy instead.
 - NamedTemporaryFile doesn't work correctly on windows (see https://bugs.python.org/issue14243)
 - sys.prefix is part of site.getsitepackages() on windows. Don't remove it.
@mikekap mikekap force-pushed the windows_fixes branch 2 times, most recently from 706536c to e787836 Compare January 13, 2016 02:38
@mikekap
Copy link
Contributor Author

mikekap commented Jan 13, 2016

Added a couple of tests for site_libs. Let me know if that's what you had in mind.

I also managed to finally get all the tests to pass on windows (you can see the commits @ https://github.com/pantsbuild/pex/compare/master...mikekap:windows?expand=1 & the build @ https://ci.appveyor.com/project/mikekap/pex/build/1.0.33). I'll open another PR once this one goes in since the changes there are a bit larger.

@mikekap
Copy link
Contributor Author

mikekap commented Jan 18, 2016

ping :)

@sdwilsh
Copy link

sdwilsh commented Jan 19, 2016

The Buck project would love to see these upstreamed so we can stop having a variety of changes to PEX in our codebase :)

kwlzn added a commit that referenced this pull request Jan 20, 2016
Fixes to get pex to work on windows.
@kwlzn kwlzn merged commit f899091 into pex-tool:master Jan 20, 2016
@kwlzn
Copy link
Contributor

kwlzn commented Jan 20, 2016

lgtm, thanks @mikekap!

will you guys need a pypi release to consume this or are you vendoring?

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.

3 participants