Skip to content

Support user install on Windows. - #4005

Merged
ilevkivskyi merged 3 commits into
python:masterfrom
emmatyping:typeshedfix
Sep 26, 2017
Merged

Support user install on Windows.#4005
ilevkivskyi merged 3 commits into
python:masterfrom
emmatyping:typeshedfix

Conversation

@emmatyping

@emmatypingemmatyping commented Sep 25, 2017

Copy link
Copy Markdown
Member

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.

@gvanrossumgvanrossum left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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

@gvanrossumgvanrossum left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

The Appveyor failure was the usual #3895

@gvanrossumgvanrossum mentioned this pull request Sep 25, 2017
5 tasks

@ilevkivskyiilevkivskyi left a comment

Copy link
Copy Markdown
Member

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.

@gvanrossumgvanrossum left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown

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

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

davt commented Oct 18, 2017

Copy link
Copy Markdown

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
Copy Markdown
Collaborator

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

Sign up for freeto 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

@emmatyping@Summertime@davt@JukkaL@gvanrossum@ilevkivskyi