Skip to content

Commit

Permalink
Merge pull request #33 from kevinconway/optional-quotes
Browse files Browse the repository at this point in the history
Fix relocation for virtualenv>=20.26.6
  • Loading branch information
kevinconway authored Oct 27, 2024
2 parents 35eeb0f + 04d54fe commit f3a5035
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 13 deletions.
21 changes: 21 additions & 0 deletions .devcontainer/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM docker.io/ubuntu:latest

RUN apt-get update && apt-get install --yes \
curl wget \
make git vim less \
sudo \
bash-completion man \
software-properties-common \
build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev \
python3-pip && \
pip install --break-system-packages tox virtualenv

RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update && \
apt-get install --yes python3.10 python3.11 python3.12 python3.13 \
python3.10-distutils python3.11-distutils \
python3-venv python3.10-venv python3.11-venv python3.13-venv python3.13-venv

RUN echo ubuntu ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/ubuntu \
&& chmod 0440 /etc/sudoers.d/ubuntu
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "venvctrl",
"build": {
"dockerfile": "Containerfile",
"context": ".."
},
"remoteUser": "ubuntu",
"updateRemoteUserUID": true,
"containerEnv": {},
"mounts": [],
"customizations": {
"vscode": {
"settings": {
"telemetry.telemetryLevel": "off",
"telemetry.enableTelemetry": false,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/bash"
}
},
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": [
"ms-python.python",
"redhat.vscode-yaml"
]
}
}
}
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python 3.8
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Cache PyPI
uses: actions/cache@v2
with:
Expand All @@ -46,7 +46,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"]
pyver: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: true
steps:
- name: Install deps
Expand Down Expand Up @@ -80,10 +80,10 @@ jobs:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install pypa/build
run: python -m pip install build
- name: Build a binary wheel and a source tarball
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="venvctrl",
version="0.7.0",
version="0.8.0",
url="https://github.com/kevinconway/venvctrl",
description="API for virtual environments.",
author="Kevin Conway",
Expand Down
12 changes: 11 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311,py312,pep8,pyflakes
envlist = py39,py310,py311,py312,py313,prequote_virtualenv,pep8,pyflakes

[testenv]
deps=
Expand All @@ -16,3 +16,13 @@ commands=
commands=
pyflakes venvctrl/
pyflakes tests/

[testenv:prequote_virtualenv]
# Version 20.26.6 of virtualenv changed the activation scripts to no longer
# include quotes around the rendered paths. This test installs the last version
# that includes quoted paths.
deps=
virtualenv<=20.26.5
-rrequirements.txt
-rtest-requirements.txt
commands=py.test tests/
12 changes: 6 additions & 6 deletions venvctrl/venv/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ class ActivateFileBash(ActivateFile):
activation scripts for bash.
"""

read_pattern = re.compile(r"""^VIRTUAL_ENV=["'](.*)["']$""")
read_pattern_stdlib_venv = re.compile(r"""^ *export VIRTUAL_ENV=["'](.*)["']$""")
read_pattern = re.compile(r"""^VIRTUAL_ENV=["']?(.*)["']?$""")
read_pattern_stdlib_venv = re.compile(r"""^ *export VIRTUAL_ENV=["']?(.*)["']?$""")

def _find_vpath(self):
"""
Expand Down Expand Up @@ -329,21 +329,21 @@ class ActivateFishFile(ActivateFile):

"""The virtual environment /bin/activate.fish script."""

read_pattern = re.compile(r"""^set -gx VIRTUAL_ENV ["'](.*)["']$""")
read_pattern = re.compile(r"""^set -gx VIRTUAL_ENV ["']?(.*)["']?$""")


class ActivateCshFile(ActivateFile):

"""The virtual environment /bin/activate.csh script."""

read_pattern = re.compile(r"""^setenv VIRTUAL_ENV ["'](.*)["']$""")
read_pattern = re.compile(r"""^setenv VIRTUAL_ENV ["']?(.*)["']?$""")


class ActivateXshFile(ActivateFile):

"""The virtual environment /bin/activate.xsh script."""

read_pattern = re.compile(r"""^\$VIRTUAL_ENV = r["'](.*)["']$""")
read_pattern = re.compile(r"""^\$VIRTUAL_ENV = r["']?(.*)["']?$""")


class ActivateNuFile(ActivateFile):
Expand All @@ -362,7 +362,7 @@ class ActivateNuFile(ActivateFile):
....let virtual_env = '/tmp/test_venv'
"""

read_pattern = re.compile(r"""^\s*let virtual[-_]env = ["'](.*)["']$""")
read_pattern = re.compile(r"""^\s*let virtual[-_]env = r?\#?["']?(.*)["']?\#?$""")


class ActivateNuFileDeactivateAlias(ActivateFile):
Expand Down

0 comments on commit f3a5035

Please sign in to comment.