Skip to content

Support user install on Windows. #4005

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

Merged
merged 3 commits into from
Sep 26, 2017
Merged

Conversation

emmatyping
Copy link
Member

@emmatyping emmatyping commented Sep 25, 2017

On Windows, the usual install paths are sys.prefix/Lib/mypy for a global
install. For user installs, the path is site.getuserbase()/lib/mypy. We
also fall back to the old method of installation due to the data dir being
put in the package directory on an egg install.

This restores the usual data directory resolution on other platforms.

Correctly fixes #3988, and keeps other platforms working.

On Windows, the usual install paths are sys.prefix/Lib/mypy for a global
install. For user installs, the path is site.getuserbase()/lib/mypy. We
also fall back to the old method of installation due to the data dir being
put in the package directory on an egg install.
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Can you get rid of the map() call? It looks too clever an I don't trust it.

@emmatyping
Copy link
Member Author

Removed. Mypy wasn't happy with the map call either.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

I'd make prefixes a list. I'll wait until I can test it myself.

@emmatyping
Copy link
Member Author

The Appveyor failure was the usual #3895

@gvanrossum gvanrossum mentioned this pull request Sep 25, 2017
5 tasks
Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

I just tried this PR on Linux, everything works.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

OK, once AppVeyor passes I'll merge (or you may).

@Summertime
Copy link

Seems like it fixed the issue I was having, works for me!

@ilevkivskyi ilevkivskyi merged commit 9615b9e into python:master Sep 26, 2017
@emmatyping emmatyping deleted the typeshedfix branch September 26, 2017 07:46
@davt
Copy link

davt commented Oct 18, 2017

Be aware that this change as shipped in 0.530 (installed from pypi) breaks when run under virtualenv on Windows.

The underlying reason is that - for reasons I don't understand - virtualenv overwrites Lib/site.py with an old version which does not include the function site.getuserbase().

Would a direct call to sysconfig.get_config_var('userbase') be a suitable workaround?

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 18, 2017

@davt Can you file a new issue for the virtualenv-on-Windows problem?

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.

typeshed not being found on windows user install
6 participants