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

Write a temporary setup.cfg to override any system distutils configuration #18

Merged
merged 3 commits into from
May 5, 2018

Conversation

rouge8
Copy link
Contributor

@rouge8 rouge8 commented May 5, 2018

Previously, shiv could not install packages that did not provide wheels using Homebrew's Pythons, because --target is incompatible with Homebrew's distutils.cfg. We can work around that by creating a setup.cfg in the same directory we run pip install containing:

[install]
prefix=

Fixes #16.

…ation

Previously, shiv could not install packages that did not provide wheels
using Homebrew's Pythons, because `--target` is incompatible with
Homebrew's `distutils.cfg`. We can work around that by creating a
`setup.cfg` in the same directory we run `pip install` containing:

```ini
[install]
prefix=
```

Fixes #16.
@coveralls
Copy link

coveralls commented May 5, 2018

Pull Request Test Coverage Report for Build 30

  • 0 of 0 (NaN%) changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+1.4%) to 70.397%

Files with Coverage Reduction New Missed Lines %
.tox/py36/lib/python3.6/site-packages/shiv/pip.py 1 96.55%
Totals Coverage Status
Change from base Build 27: 1.4%
Covered Lines: 195
Relevant Lines: 277

💛 - Coveralls

src/shiv/cli.py Outdated
# breaks `pip install --target` with any non-wheel packages. We can
# work around that by creating a setup.cfg specifying an empty prefix
# in the directory we run `pip install` from.
with Path(working_path, "setup.cfg").open('w') as f:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe a better place for this would be in clean_pip_env() 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

that’s exactly what i was going to suggest! makes perfect sense there

@rouge8
Copy link
Contributor Author

rouge8 commented May 5, 2018

Done! Once it was in clean_pip_env() it was also a lot easier to test 😌. LMK if you want me to squash these commits or make any more changes.

@lorencarvalho lorencarvalho merged commit 33cf133 into linkedin:master May 5, 2018
@lorencarvalho
Copy link
Contributor

thanks so much @rouge8 !

@lorencarvalho
Copy link
Contributor

lorencarvalho commented May 5, 2018

@rouge8 heads up, I added a commit after this PR merged because I noticed that I was unable to create a shiv from a project dir (e.g. pip install .) ... this is vital functionality for us internally.

The commit is a2ad1bc and while it works, it is a little scary to be stomping on existing setup.cfg files, even though we restore them... will need to think on it a bit.

@rouge8
Copy link
Contributor Author

rouge8 commented May 5, 2018

ooof. I wonder if there's a straightforward way to determine if an argument is a path, and if so convert it to an absolute path 😕

@lorencarvalho
Copy link
Contributor

yo! that's a great idea... PR incoming

@lorencarvalho lorencarvalho mentioned this pull request May 5, 2018
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.

distutils.errors.DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both
3 participants