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

Add symlink to current appenv. #45

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

sweh
Copy link
Contributor

@sweh sweh commented Feb 6, 2024

This allows adding a stable path to the Python interpreter in IDEs like VS Code.

@elikoga
Copy link
Member

elikoga commented Feb 20, 2024

Once #38 is merged, I'd add this test:

def test_prepare_creates_venv_symlink(workdir, monkeypatch):
    # asserts that appenv_dir / "current" -> env_dir
    monkeypatch.setattr('sys.stdin', io.StringIO('ducker\nducker<2.0.2\n\n'))
    os.makedirs(os.path.join(workdir, 'ducker'))

    env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
    env.init()
    env.update_lockfile()
    env.prepare()
    assert os.path.islink(os.path.join(env.appenv_dir, "current"))
    assert os.readlink(os.path.join(env.appenv_dir, "current")) == env.env_dir

to the test file introduced there. I could create the commit before, but it'd merge conflict when rebasing later

@@ -364,6 +367,12 @@ def _prepare(self):

with open(os.path.join(env_dir, "appenv.ready"), "w") as f:
f.write("Ready or not, here I come, you can't hide\n")
current_path = os.path.join(self.appenv_dir, 'current')
try:
os.unlink(current_path)
Copy link
Member

Choose a reason for hiding this comment

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

I'd actually prefer os.remove, but 🤷

sweh and others added 2 commits February 21, 2024 12:29
This allows adding a stable path to the Python interpreter in IDEs like
VS Code.
@elikoga elikoga force-pushed the symlink_to_current_appenv branch from 6de2133 to 01bad4e Compare February 21, 2024 11:30
@elikoga elikoga merged commit 227a08b into flyingcircusio:master Feb 21, 2024
5 checks passed
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