Skip to content

Commit f3a5035

Browse files
authored
Merge pull request #33 from kevinconway/optional-quotes
Fix relocation for virtualenv>=20.26.6
2 parents 35eeb0f + 04d54fe commit f3a5035

File tree

6 files changed

+75
-13
lines changed

6 files changed

+75
-13
lines changed

.devcontainer/Containerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM docker.io/ubuntu:latest
2+
3+
RUN apt-get update && apt-get install --yes \
4+
curl wget \
5+
make git vim less \
6+
sudo \
7+
bash-completion man \
8+
software-properties-common \
9+
build-essential libssl-dev zlib1g-dev libbz2-dev \
10+
libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev \
11+
xz-utils tk-dev libffi-dev liblzma-dev \
12+
python3-pip && \
13+
pip install --break-system-packages tox virtualenv
14+
15+
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update && \
16+
apt-get install --yes python3.10 python3.11 python3.12 python3.13 \
17+
python3.10-distutils python3.11-distutils \
18+
python3-venv python3.10-venv python3.11-venv python3.13-venv python3.13-venv
19+
20+
RUN echo ubuntu ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/ubuntu \
21+
&& chmod 0440 /etc/sudoers.d/ubuntu

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "venvctrl",
3+
"build": {
4+
"dockerfile": "Containerfile",
5+
"context": ".."
6+
},
7+
"remoteUser": "ubuntu",
8+
"updateRemoteUserUID": true,
9+
"containerEnv": {},
10+
"mounts": [],
11+
"customizations": {
12+
"vscode": {
13+
"settings": {
14+
"telemetry.telemetryLevel": "off",
15+
"telemetry.enableTelemetry": false,
16+
"files.insertFinalNewline": true,
17+
"files.trimTrailingWhitespace": true,
18+
"terminal.integrated.profiles.linux": {
19+
"bash": {
20+
"path": "/usr/bin/bash"
21+
}
22+
},
23+
"terminal.integrated.defaultProfile.linux": "bash"
24+
},
25+
"extensions": [
26+
"ms-python.python",
27+
"redhat.vscode-yaml"
28+
]
29+
}
30+
}
31+
}

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v2
20-
- name: Setup Python 3.8
20+
- name: Setup Python 3.9
2121
uses: actions/setup-python@v2
2222
with:
23-
python-version: 3.8
23+
python-version: 3.9
2424
- name: Cache PyPI
2525
uses: actions/cache@v2
2626
with:
@@ -46,7 +46,7 @@ jobs:
4646
runs-on: ubuntu-latest
4747
strategy:
4848
matrix:
49-
pyver: ["3.8", "3.9", "3.10", "3.11", "3.12"]
49+
pyver: ["3.9", "3.10", "3.11", "3.12", "3.13"]
5050
fail-fast: true
5151
steps:
5252
- name: Install deps
@@ -80,10 +80,10 @@ jobs:
8080
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
8181
steps:
8282
- uses: actions/checkout@v2
83-
- name: Set up Python 3.8
83+
- name: Set up Python 3.9
8484
uses: actions/setup-python@v2
8585
with:
86-
python-version: 3.8
86+
python-version: 3.9
8787
- name: Install pypa/build
8888
run: python -m pip install build
8989
- name: Build a binary wheel and a source tarball

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name="venvctrl",
13-
version="0.7.0",
13+
version="0.8.0",
1414
url="https://github.com/kevinconway/venvctrl",
1515
description="API for virtual environments.",
1616
author="Kevin Conway",

tox.ini

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py38,py39,py310,py311,py312,pep8,pyflakes
2+
envlist = py39,py310,py311,py312,py313,prequote_virtualenv,pep8,pyflakes
33

44
[testenv]
55
deps=
@@ -16,3 +16,13 @@ commands=
1616
commands=
1717
pyflakes venvctrl/
1818
pyflakes tests/
19+
20+
[testenv:prequote_virtualenv]
21+
# Version 20.26.6 of virtualenv changed the activation scripts to no longer
22+
# include quotes around the rendered paths. This test installs the last version
23+
# that includes quoted paths.
24+
deps=
25+
virtualenv<=20.26.5
26+
-rrequirements.txt
27+
-rtest-requirements.txt
28+
commands=py.test tests/

venvctrl/venv/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ class ActivateFileBash(ActivateFile):
281281
activation scripts for bash.
282282
"""
283283

284-
read_pattern = re.compile(r"""^VIRTUAL_ENV=["'](.*)["']$""")
285-
read_pattern_stdlib_venv = re.compile(r"""^ *export VIRTUAL_ENV=["'](.*)["']$""")
284+
read_pattern = re.compile(r"""^VIRTUAL_ENV=["']?(.*)["']?$""")
285+
read_pattern_stdlib_venv = re.compile(r"""^ *export VIRTUAL_ENV=["']?(.*)["']?$""")
286286

287287
def _find_vpath(self):
288288
"""
@@ -329,21 +329,21 @@ class ActivateFishFile(ActivateFile):
329329

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

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

334334

335335
class ActivateCshFile(ActivateFile):
336336

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

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

341341

342342
class ActivateXshFile(ActivateFile):
343343

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

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

348348

349349
class ActivateNuFile(ActivateFile):
@@ -362,7 +362,7 @@ class ActivateNuFile(ActivateFile):
362362
....let virtual_env = '/tmp/test_venv'
363363
"""
364364

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

367367

368368
class ActivateNuFileDeactivateAlias(ActivateFile):

0 commit comments

Comments
 (0)