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: resolve env path in case windows redirects installation path #18

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

finswimmer
Copy link
Member

@finswimmer finswimmer commented Jun 29, 2022

Applications installed from the Microsoft Store are not allowed to write directly into %Appdata%, instead any attempt to do this is redirected to a sandbox folder located at C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0.

Fortunately when one try to access this place during runtime, the Path object is a symlink that can be resolved and than be passed to the subprocess call that creates the venv.

Relates-To: python-poetry/poetry#5931, python-poetry/poetry#5331

@vercel
Copy link

vercel bot commented Jun 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
install-python-poetry-org ✅ Ready (Inspect) Visit Preview Jun 30, 2022 at 9:37AM (UTC)

@finswimmer finswimmer marked this pull request as ready for review June 30, 2022 09:54
@finswimmer finswimmer requested a review from a team June 30, 2022 09:54
@Secrus
Copy link
Member

Secrus commented Jun 30, 2022

Is there any way other than manual that we can test it?

@finswimmer
Copy link
Member Author

Is there any way other than manual that we can test it?

I'm not aware of any other way. In an ideal world there would be an image for the github checks with windows and python installed from the store.

Copy link
Member

@mkniewallner mkniewallner left a comment

Choose a reason for hiding this comment

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

Tested on a Windows partition, and installation works flawlessly for both 1.2.0b2 and 1.1.13:

$ (Invoke-WebRequest -Uri https://raw.githubusercontent.com/finswimmer/install.python-poetry.org/6331d00f788525eba1e349cabe63df225b2aa6e4/install-poetry.py -UseBasicParsing).Content | python3 - --preview
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

C:\Users\<REDACTED>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Scripts

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.2.0b2)
Installing Poetry (1.2.0b2): Creating environment
Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "C:\Users\<REDACTED>\AppData\Roaming\pypoetry\venv\Scripts\python.exe"
  Actual location:    "C:\Users\<REDACTED>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\Roaming\pypoetry\venv\Scripts\python.exe"
Installing Poetry (1.2.0b2): Installing Poetry
Installing Poetry (1.2.0b2): Creating script
Installing Poetry (1.2.0b2): Done

Poetry (1.2.0b2) is installed now. Great!

To get started you need Poetry's bin directory (C:\Users\<REDACTED>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Scripts) in your `PATH`
environment variable.

Alternatively, you can call Poetry explicitly with `C:\Users\<REDACTED>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Scripts\poetry`.

You can test that everything is set up by executing:

`poetry --version`

Uninstalling Poetry seems to not delete C:\Users\<REDACTED>\AppData\Local\Packages\<PYTHON_APP>\LocalCache\local-packages\Scripts\poetry.exe though. It only deletes C:\Users\<REDACTED>\AppData\Local\Packages\<PYTHON_APP>\LocalCache\Roaming\pypoetry directory on my end.

Though quickly testing with the non MS Store Python, the behavior seems to be the same, so this may have to do with how we currently globally handle Windows on the install script.

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.

4 participants