Skip to content

Commit c458ffe

Browse files
committed
Devcontainer: use devcontainer id as key for venv and build directory
... otherwise different devcontainers would try to reuse the same venv/build directory - which will not work as the underlying os of the devcontainer can be quite different.
1 parent 1f45900 commit c458ffe

File tree

8 files changed

+32
-3
lines changed

8 files changed

+32
-3
lines changed

.devcontainer/onCreate-meson.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
SYSTEM=$(build/bin/sage-guess-package-system)
44

5-
if [ "$SYSTEM" = "fedora" ]; then
5+
if [ "$SYSTEM" = "fedora" ] && [ -f /etc/fedora-release ]; then
66
# Need to use --setopt=tsflags="" to avoid errors with gphelp
77
dnf5 install -y pari-gp --setopt=tsflags=""
88

@@ -16,7 +16,8 @@ eval $(build/bin/sage-print-system-package-command $SYSTEM --yes --ignore-missin
1616

1717
# Disable build isolation following the advice of https://mesonbuild.com/meson-python/how-to-guides/editable-installs.html#build-dependencies
1818
# Install build dependencies manually as workaround for https://github.com/astral-sh/uv/issues/1516
19-
uv venv
19+
uv venv --clear
20+
. $UV_PROJECT_ENVIRONMENT/bin/activate # https://github.com/astral-sh/uv/issues/14022
2021
uv pip install \
2122
meson-python \
2223
"cypari2 >=2.2.1" \
@@ -27,4 +28,4 @@ uv pip install \
2728
"numpy >=1.25" \
2829
jinja2 \
2930
setuptools
30-
uv sync --frozen --inexact --no-build-isolation --config-settings=builddir=build/build-$SYSTEM
31+
uv sync --frozen --inexact --no-build-isolation -v --config-settings=builddir=build/build-$SYSTEM-$devcontainerId

.devcontainer/portability-archlinux/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"version": "latest"
1414
}
1515
},
16+
"containerEnv": {
17+
"devcontainerId": "${devcontainerId}",
18+
"UV_PROJECT_ENVIRONMENT": ".venv-${devcontainerId}"
19+
},
1620
"customizations": {
1721
"vscode": {
1822
"extensions": [

.devcontainer/portability-fedora-41/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"version": "latest"
1111
}
1212
},
13+
"containerEnv": {
14+
"devcontainerId": "${devcontainerId}",
15+
"UV_PROJECT_ENVIRONMENT": ".venv-${devcontainerId}"
16+
},
1317
"customizations": {
1418
"vscode": {
1519
"extensions": [

.devcontainer/portability-fedora-42/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"version": "latest"
1111
}
1212
},
13+
"containerEnv": {
14+
"devcontainerId": "${devcontainerId}",
15+
"UV_PROJECT_ENVIRONMENT": ".venv-${devcontainerId}"
16+
},
1317
"customizations": {
1418
"vscode": {
1519
"extensions": [

.devcontainer/portability-ubuntu-2204/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"version": "latest"
1111
}
1212
},
13+
"containerEnv": {
14+
"devcontainerId": "${devcontainerId}",
15+
"UV_PROJECT_ENVIRONMENT": ".venv-${devcontainerId}"
16+
},
1317
"customizations": {
1418
"vscode": {
1519
"extensions": [

.devcontainer/portability-ubuntu-2404/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"version": "latest"
1111
}
1212
},
13+
"containerEnv": {
14+
"devcontainerId": "${devcontainerId}",
15+
"UV_PROJECT_ENVIRONMENT": ".venv-${devcontainerId}"
16+
},
1317
"customizations": {
1418
"vscode": {
1519
"extensions": [

.devcontainer/portability-ubuntu-2504/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"version": "latest"
1111
}
1212
},
13+
"containerEnv": {
14+
"devcontainerId": "${devcontainerId}",
15+
"UV_PROJECT_ENVIRONMENT": ".venv-${devcontainerId}"
16+
},
1317
"customizations": {
1418
"vscode": {
1519
"extensions": [

.devcontainer/portability-void/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"version": "latest"
1515
}
1616
},
17+
"containerEnv": {
18+
"devcontainerId": "${devcontainerId}",
19+
"UV_PROJECT_ENVIRONMENT": ".venv-${devcontainerId}"
20+
},
1721
"customizations": {
1822
"vscode": {
1923
"extensions": [

0 commit comments

Comments
 (0)