sentry-devenv 1.24.0__py3-none-any.whl → 1.26.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- devenv/checks/diskfree.py +38 -0
- devenv/doctor.py +2 -1
- devenv/lib/colima.py +20 -12
- devenv/lib/node.py +50 -53
- {sentry_devenv-1.24.0.dist-info → sentry_devenv-1.26.0.dist-info}/METADATA +31 -112
- {sentry_devenv-1.24.0.dist-info → sentry_devenv-1.26.0.dist-info}/RECORD +10 -9
- {sentry_devenv-1.24.0.dist-info → sentry_devenv-1.26.0.dist-info}/WHEEL +1 -1
- tests/lib/test_node.py +37 -0
- devenv/checks/test.py +0 -36
- {sentry_devenv-1.24.0.dist-info → sentry_devenv-1.26.0.dist-info}/entry_points.txt +0 -0
- {sentry_devenv-1.24.0.dist-info → sentry_devenv-1.26.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import shutil
|
|
4
|
+
|
|
5
|
+
from devenv.lib_check.types import checker
|
|
6
|
+
from devenv.lib_check.types import fixer
|
|
7
|
+
|
|
8
|
+
tags: set[str] = {"builtin"}
|
|
9
|
+
name = "there should be sufficient host disk space"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@checker
|
|
13
|
+
def check() -> tuple[bool, str]:
|
|
14
|
+
disk_total, disk_used, disk_free = shutil.disk_usage("/")
|
|
15
|
+
disk_gib_free = disk_free / (1024**3)
|
|
16
|
+
|
|
17
|
+
if disk_gib_free < 10000:
|
|
18
|
+
return (
|
|
19
|
+
False,
|
|
20
|
+
f"You have less than 10 GiB disk free ({disk_gib_free} GiB free). "
|
|
21
|
+
"You might start to encounter various problems when using colima.",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return True, ""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@fixer
|
|
28
|
+
def fix() -> tuple[bool, str]:
|
|
29
|
+
return (
|
|
30
|
+
False,
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
We can't autofix this, only you can clean up your own disk.
|
|
34
|
+
|
|
35
|
+
You might want to try cleaning up unused Docker resources:
|
|
36
|
+
docker system prune -a
|
|
37
|
+
""",
|
|
38
|
+
)
|
devenv/doctor.py
CHANGED
|
@@ -245,7 +245,8 @@ def main(context: Context, argv: Sequence[str] | None = None) -> int:
|
|
|
245
245
|
skip.append(check)
|
|
246
246
|
|
|
247
247
|
print("\nChecking that fixes worked as expected...")
|
|
248
|
-
|
|
248
|
+
# re-run all checks since fixing one issue can cause another to fail
|
|
249
|
+
results = run_checks(checks, executor, skip=skip)
|
|
249
250
|
|
|
250
251
|
executor.shutdown()
|
|
251
252
|
|
devenv/lib/colima.py
CHANGED
|
@@ -104,9 +104,9 @@ def check() -> ColimaStatus:
|
|
|
104
104
|
if not os.getenv("CI"):
|
|
105
105
|
macos_version = platform.mac_ver()[0]
|
|
106
106
|
macos_major_version = int(macos_version.split(".")[0])
|
|
107
|
-
if macos_major_version <
|
|
107
|
+
if macos_major_version < 15:
|
|
108
108
|
raise SystemExit(
|
|
109
|
-
f"macos >=
|
|
109
|
+
f"macos >= 15 is required to use colima, found {macos_version}"
|
|
110
110
|
)
|
|
111
111
|
|
|
112
112
|
docker_executable = shutil.which("docker")
|
|
@@ -142,17 +142,23 @@ def check() -> ColimaStatus:
|
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
def start(restart: bool = False) -> ColimaStatus:
|
|
145
|
+
# switch to default context to avoid broken contexts (e.g., desktop-linux)
|
|
146
|
+
try:
|
|
147
|
+
proc.run(("docker", "context", "use", "default"))
|
|
148
|
+
except RuntimeError as e:
|
|
149
|
+
print(f"Failed to switch docker context: {e}")
|
|
150
|
+
|
|
145
151
|
status = check()
|
|
146
152
|
|
|
147
153
|
if status == ColimaStatus.UP:
|
|
148
154
|
if not restart:
|
|
149
155
|
return ColimaStatus.UP
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
|
|
157
|
+
# always stop first (colima's internal state can get out of sync)
|
|
158
|
+
try:
|
|
159
|
+
proc.run(("colima", "stop", "-f"), pathprepend=f"{root}/bin")
|
|
160
|
+
except RuntimeError as e:
|
|
161
|
+
print(f"Failed to stop colima: {e}")
|
|
156
162
|
|
|
157
163
|
# colima start will only WARN if rosetta is unavailable and keep going without it,
|
|
158
164
|
# so we need to ensure it's installed and running ourselves
|
|
@@ -174,15 +180,16 @@ def start(restart: bool = False) -> ColimaStatus:
|
|
|
174
180
|
if platform.machine() == "arm64":
|
|
175
181
|
args = [*args, "--vm-type=vz", "--vz-rosetta", "--mount-type=virtiofs"]
|
|
176
182
|
|
|
177
|
-
# removing all docker contexts to ensure only colima context is created
|
|
178
|
-
shutil.rmtree(f"{home}/.docker/contexts", ignore_errors=True)
|
|
179
|
-
|
|
180
183
|
proc.run(
|
|
181
184
|
(
|
|
182
185
|
# we share the "default" machine across repositories
|
|
183
186
|
"colima",
|
|
184
187
|
"start",
|
|
185
188
|
"--verbose",
|
|
189
|
+
# we're overprovisioning a 512 GiB disk here which is fine because
|
|
190
|
+
# the disk doesn't reserve space and is copy-on-write
|
|
191
|
+
"--disk",
|
|
192
|
+
"512",
|
|
186
193
|
# this effectively makes the vm's resolvectl status use:
|
|
187
194
|
# DNS Servers: 8.8.8.8 1.1.1.1 192.168.5.2
|
|
188
195
|
# https://lima-vm.io/docs/config/network/user/
|
|
@@ -196,7 +203,8 @@ def start(restart: bool = False) -> ColimaStatus:
|
|
|
196
203
|
"1.1.1.1",
|
|
197
204
|
# ideally we keep ~ ro, but currently the "default" vm
|
|
198
205
|
# is shared across repositories, so for ease of use we'll let home rw
|
|
199
|
-
f"--mount=/var/folders:w,/private/tmp/colima:w,{home}:w,/tmp
|
|
206
|
+
f"--mount=/var/folders:w,/private/tmp/colima:w,{home}:w,/tmp/sentry-profiles:w",
|
|
207
|
+
# note: it is not allowed by lima to add top-level root directories like /tmp!
|
|
200
208
|
*args,
|
|
201
209
|
),
|
|
202
210
|
pathprepend=f"{root}/bin",
|
devenv/lib/node.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import json
|
|
3
4
|
import os
|
|
4
5
|
import shutil
|
|
5
6
|
import tempfile
|
|
@@ -9,7 +10,7 @@ from devenv.lib import fs
|
|
|
9
10
|
from devenv.lib import proc
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
_shims = ("node", "npm", "npx"
|
|
13
|
+
_shims = ("node", "npm", "npx")
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def _install(url: str, sha256: str, into: str) -> None:
|
|
@@ -32,7 +33,7 @@ def _install(url: str, sha256: str, into: str) -> None:
|
|
|
32
33
|
def uninstall(binroot: str) -> None:
|
|
33
34
|
shutil.rmtree(f"{binroot}/node-env", ignore_errors=True)
|
|
34
35
|
|
|
35
|
-
for shim in (*_shims, "
|
|
36
|
+
for shim in (*_shims, "pnpm"):
|
|
36
37
|
fp = f"{binroot}/{shim}"
|
|
37
38
|
try:
|
|
38
39
|
os.remove(fp)
|
|
@@ -71,6 +72,51 @@ def installed(version: str, binroot: str) -> bool:
|
|
|
71
72
|
return False
|
|
72
73
|
|
|
73
74
|
|
|
75
|
+
def installed_pnpm(version: str, binroot: str) -> bool:
|
|
76
|
+
if shutil.which(
|
|
77
|
+
"pnpm", path=binroot
|
|
78
|
+
) != f"{binroot}/pnpm" or not os.path.exists(
|
|
79
|
+
f"{binroot}/node-env/bin/pnpm"
|
|
80
|
+
):
|
|
81
|
+
return False
|
|
82
|
+
|
|
83
|
+
stdout = proc.run((f"{binroot}/pnpm", "--version"), stdout=True)
|
|
84
|
+
installed_version = stdout.strip()
|
|
85
|
+
return version == installed_version
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def install_pnpm(reporoot: str) -> None:
|
|
89
|
+
binroot = fs.ensure_binroot(reporoot)
|
|
90
|
+
|
|
91
|
+
with open(f"{reporoot}/package.json") as f:
|
|
92
|
+
package_json = json.load(f)
|
|
93
|
+
pnpm = package_json["packageManager"]
|
|
94
|
+
pnpm_version = pnpm.split("@")[-1]
|
|
95
|
+
|
|
96
|
+
if installed_pnpm(pnpm_version, binroot):
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
print(f"installing pnpm {pnpm_version}...")
|
|
100
|
+
|
|
101
|
+
# {binroot}/npm is a devenv-managed shim, so
|
|
102
|
+
# this install -g ends up putting pnpm into
|
|
103
|
+
# .devenv/bin/node-env/bin/pnpm which is pointed
|
|
104
|
+
# to by the {binroot}/pnpm shim
|
|
105
|
+
proc.run(
|
|
106
|
+
(f"{binroot}/npm", "install", "-g", f"pnpm@{pnpm_version}"), stdout=True
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
fs.write_script(
|
|
110
|
+
f"{binroot}/pnpm",
|
|
111
|
+
"""#!/bin/sh
|
|
112
|
+
export PATH={binroot}/node-env/bin:"${{PATH}}"
|
|
113
|
+
export NPM_CONFIG_PREFIX={binroot}/node-env
|
|
114
|
+
exec {binroot}/node-env/bin/pnpm "$@"
|
|
115
|
+
""",
|
|
116
|
+
shell_escape={"binroot": binroot},
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
74
120
|
def install(version: str, url: str, sha256: str, reporoot: str) -> None:
|
|
75
121
|
binroot = fs.ensure_binroot(reporoot)
|
|
76
122
|
|
|
@@ -81,9 +127,8 @@ def install(version: str, url: str, sha256: str, reporoot: str) -> None:
|
|
|
81
127
|
uninstall(binroot)
|
|
82
128
|
_install(url, sha256, binroot)
|
|
83
129
|
|
|
84
|
-
# NPM_CONFIG_PREFIX is needed to ensure npm install -g
|
|
85
|
-
# puts
|
|
86
|
-
|
|
130
|
+
# NPM_CONFIG_PREFIX is needed to ensure npm install -g pnpm
|
|
131
|
+
# puts pnpm into our node-env.
|
|
87
132
|
for shim in _shims:
|
|
88
133
|
fs.write_script(
|
|
89
134
|
f"{binroot}/{shim}",
|
|
@@ -97,51 +142,3 @@ exec {binroot}/node-env/bin/{shim} "$@"
|
|
|
97
142
|
|
|
98
143
|
if not installed(version, binroot):
|
|
99
144
|
raise SystemExit(f"failed to install node {version}!")
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def installed_yarn(version: str, binroot: str) -> bool:
|
|
103
|
-
if shutil.which(
|
|
104
|
-
"yarn", path=binroot
|
|
105
|
-
) != f"{binroot}/yarn" or not os.path.exists(
|
|
106
|
-
f"{binroot}/node-env/bin/yarn"
|
|
107
|
-
):
|
|
108
|
-
return False
|
|
109
|
-
|
|
110
|
-
with open(f"{binroot}/yarn", "r") as f:
|
|
111
|
-
sample = f.read(64)
|
|
112
|
-
if "VOLTA_HOME" in sample:
|
|
113
|
-
print("volta-based yarn detected")
|
|
114
|
-
return False
|
|
115
|
-
|
|
116
|
-
stdout = proc.run((f"{binroot}/yarn", "--version"), stdout=True)
|
|
117
|
-
installed_version = stdout.strip()
|
|
118
|
-
if version == installed_version:
|
|
119
|
-
return True
|
|
120
|
-
|
|
121
|
-
print(f"installed yarn {installed_version} is unexpected!")
|
|
122
|
-
return False
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
def install_yarn(version: str, reporoot: str) -> None:
|
|
126
|
-
binroot = fs.ensure_binroot(reporoot)
|
|
127
|
-
|
|
128
|
-
if installed_yarn(version, binroot):
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
# not explicitly uninstalling here, following steps
|
|
132
|
-
# will pave over it
|
|
133
|
-
print(f"installing yarn {version}...")
|
|
134
|
-
|
|
135
|
-
proc.run((f"{binroot}/npm", "install", "-g", f"yarn@{version}"))
|
|
136
|
-
|
|
137
|
-
fs.write_script(
|
|
138
|
-
f"{binroot}/yarn",
|
|
139
|
-
"""#!/bin/sh
|
|
140
|
-
export PATH={binroot}/node-env/bin:"${{PATH}}"
|
|
141
|
-
exec {binroot}/node-env/bin/yarn "$@"
|
|
142
|
-
""",
|
|
143
|
-
shell_escape={"binroot": binroot},
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
if not installed_yarn(version, binroot):
|
|
147
|
-
raise SystemExit(f"failed to install yarn {version}!")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sentry_devenv
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.26.0
|
|
4
4
|
Summary: Utilities for setting up a Sentry development environment
|
|
5
5
|
Author-email: Joshua Li <joshua.li@sentry.io>, Ian Woodard <ian.woodard@sentry.io>, Buck Evan <buck.evan@sentry.io>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -84,6 +84,10 @@ This updates the global devenv installation, and global tools.
|
|
|
84
84
|
If you're upgrading from a particularly old devenv, it won't have `update` so you need to:
|
|
85
85
|
`~/.local/share/sentry-devenv/venv/bin/pip install -U sentry-devenv`
|
|
86
86
|
|
|
87
|
+
`devenv colima start`
|
|
88
|
+
|
|
89
|
+
If you are using colima instead of docker desktop, run this to set up colima on a new machine. The default `colima start` may underprovision resources. Run this command after `colima delete` to reset.
|
|
90
|
+
|
|
87
91
|
|
|
88
92
|
## technical overview
|
|
89
93
|
|
|
@@ -119,7 +123,7 @@ coderoot = ~/code
|
|
|
119
123
|
```ini
|
|
120
124
|
[devenv]
|
|
121
125
|
# optionally require a minimum version to run sync.py
|
|
122
|
-
minimum_version = 1.
|
|
126
|
+
minimum_version = 1.22.1
|
|
123
127
|
```
|
|
124
128
|
|
|
125
129
|
There are plenty more sections, their use is best seen in the [examples](#examples).
|
|
@@ -157,7 +161,11 @@ PATH_add "${PWD}/.devenv/bin"
|
|
|
157
161
|
|
|
158
162
|
### python
|
|
159
163
|
|
|
160
|
-
|
|
164
|
+
We have support for, and we standardize on [uv](https://github.com/astral-sh/uv)
|
|
165
|
+
to manage python environments.
|
|
166
|
+
|
|
167
|
+
More details (beyond a bare minimum example which is detailed here) about the standard is
|
|
168
|
+
[here](https://www.notion.so/sentry/Standard-Spec-python-uv-2248b10e4b5d8045b8fff30f8b8b67ca).
|
|
161
169
|
|
|
162
170
|
`[reporoot]/.envrc`
|
|
163
171
|
```bash
|
|
@@ -166,11 +174,10 @@ export VIRTUAL_ENV="${PWD}/.venv"
|
|
|
166
174
|
PATH_add "${PWD}/.venv/bin"
|
|
167
175
|
```
|
|
168
176
|
|
|
169
|
-
if using uv:
|
|
170
|
-
|
|
171
177
|
`[reporoot]/devenv/sync.py`
|
|
172
178
|
```py
|
|
173
|
-
from devenv
|
|
179
|
+
from devenv import constants
|
|
180
|
+
from devenv.lib import config, proc, uv
|
|
174
181
|
|
|
175
182
|
def main(context: dict[str, str]) -> int:
|
|
176
183
|
reporoot = context["reporoot"]
|
|
@@ -190,22 +197,27 @@ def main(context: dict[str, str]) -> int:
|
|
|
190
197
|
return 0
|
|
191
198
|
```
|
|
192
199
|
|
|
200
|
+
We pin the uv version to avoid any surprises.
|
|
201
|
+
(As opposed to a solution like `brew`, which always puts you on latest software.)
|
|
202
|
+
If you want to update the version then you'll have to update these urls and checksums.
|
|
203
|
+
|
|
193
204
|
`[reporoot]/devenv/config.ini`
|
|
194
205
|
```ini
|
|
195
206
|
[devenv]
|
|
196
207
|
minimum_version = 1.22.1
|
|
197
208
|
|
|
198
209
|
[uv]
|
|
199
|
-
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.
|
|
200
|
-
darwin_arm64_sha256 =
|
|
201
|
-
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.
|
|
202
|
-
darwin_x86_64_sha256 =
|
|
203
|
-
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.
|
|
204
|
-
linux_arm64_sha256 =
|
|
205
|
-
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.
|
|
206
|
-
linux_x86_64_sha256 =
|
|
210
|
+
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-apple-darwin.tar.gz
|
|
211
|
+
darwin_arm64_sha256 = 954d24634d5f37fa26c7af75eb79893d11623fc81b4de4b82d60d1ade4bfca22
|
|
212
|
+
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-apple-darwin.tar.gz
|
|
213
|
+
darwin_x86_64_sha256 = ae755df53c8c2c1f3dfbee6e3d2e00be0dfbc9c9b4bdffdb040b96f43678b7ce
|
|
214
|
+
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-unknown-linux-gnu.tar.gz
|
|
215
|
+
linux_arm64_sha256 = 27da35ef54e9131c2e305de67dd59a07c19257882c6b1f3cf4d8d5fbb8eaf4ca
|
|
216
|
+
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-unknown-linux-gnu.tar.gz
|
|
217
|
+
linux_x86_64_sha256 = 6dcb28a541868a455aefb2e8d4a1283dd6bf888605a2db710f0530cec888b0ad
|
|
207
218
|
# used for autoupdate
|
|
208
|
-
|
|
219
|
+
# NOTE: if using uv-build as a build backend, you'll have to make sure the versions match
|
|
220
|
+
version = 0.8.2
|
|
209
221
|
```
|
|
210
222
|
|
|
211
223
|
`[reporoot]/.python-version`
|
|
@@ -220,98 +232,6 @@ name = "foo"
|
|
|
220
232
|
version = "0.0.0"
|
|
221
233
|
```
|
|
222
234
|
|
|
223
|
-
or classic pip:
|
|
224
|
-
|
|
225
|
-
`[reporoot]/devenv/sync.py`
|
|
226
|
-
```py
|
|
227
|
-
from devenv.lib import config, venv
|
|
228
|
-
|
|
229
|
-
def main(context: dict[str, str]) -> int:
|
|
230
|
-
reporoot = context["reporoot"]
|
|
231
|
-
|
|
232
|
-
venv_dir, python_version, requirements, editable_paths, bins = venv.get(reporoot, "venv")
|
|
233
|
-
url, sha256 = config.get_python(reporoot, python_version)
|
|
234
|
-
print(f"ensuring venv at {venv_dir}...")
|
|
235
|
-
venv.ensure(venv_dir, python_version, url, sha256)
|
|
236
|
-
|
|
237
|
-
print(f"syncing venv with {requirements}...")
|
|
238
|
-
venv.sync(reporoot, venv_dir, requirements, editable_paths, bins)
|
|
239
|
-
|
|
240
|
-
return 0
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
`[reporoot]/devenv/config.ini`
|
|
244
|
-
```ini
|
|
245
|
-
[venv.venv]
|
|
246
|
-
python = 3.12.3
|
|
247
|
-
path = .venv
|
|
248
|
-
requirements = requirements-dev.txt
|
|
249
|
-
editable =
|
|
250
|
-
.
|
|
251
|
-
|
|
252
|
-
[python3.12.3]
|
|
253
|
-
darwin_x86_64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-x86_64-apple-darwin-install_only.tar.gz
|
|
254
|
-
darwin_x86_64_sha256 = c37a22fca8f57d4471e3708de6d13097668c5f160067f264bb2b18f524c890c8
|
|
255
|
-
darwin_arm64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-aarch64-apple-darwin-install_only.tar.gz
|
|
256
|
-
darwin_arm64_sha256 = ccc40e5af329ef2af81350db2a88bbd6c17b56676e82d62048c15d548401519e
|
|
257
|
-
linux_x86_64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-x86_64-unknown-linux-gnu-install_only.tar.gz
|
|
258
|
-
linux_x86_64_sha256 = a73ba777b5d55ca89edef709e6b8521e3f3d4289581f174c8699adfb608d09d6
|
|
259
|
-
linux_arm64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-aarch64-unknown-linux-gnu-install_only.tar.gz
|
|
260
|
-
linux_arm64_sha256 = ec8126de97945e629cca9aedc80a29c4ae2992c9d69f2655e27ae73906ba187d
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
You can also have multiple virtualenvs, which is useful if you rely on a python tool
|
|
264
|
-
that has a bunch of dependencies that may conflict with others.
|
|
265
|
-
|
|
266
|
-
`[reporoot]/.envrc`
|
|
267
|
-
```bash
|
|
268
|
-
export VIRTUAL_ENV="${PWD}/.exampleproject"
|
|
269
|
-
|
|
270
|
-
PATH_add "${PWD}/.venv-exampleproject/bin"
|
|
271
|
-
PATH_add "${PWD}/.venv-inhouse-tool/bin"
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
`[reporoot]/devenv/sync.py`
|
|
275
|
-
```py
|
|
276
|
-
from devenv.lib import config, venv
|
|
277
|
-
|
|
278
|
-
def main(context: dict[str, str]) -> int:
|
|
279
|
-
reporoot = context["reporoot"]
|
|
280
|
-
|
|
281
|
-
for name in ("exampleproject", "inhouse-tool"):
|
|
282
|
-
venv_dir, python_version, requirements, editable_paths, bins = venv.get(reporoot, name)
|
|
283
|
-
url, sha256 = config.get_python(reporoot, python_version)
|
|
284
|
-
print(f"ensuring {name} venv at {venv_dir}...")
|
|
285
|
-
venv.ensure(venv_dir, python_version, url, sha256)
|
|
286
|
-
|
|
287
|
-
print(f"syncing {name} with {requirements}...")
|
|
288
|
-
venv.sync(reporoot, venv_dir, requirements, editable_paths, bins)
|
|
289
|
-
|
|
290
|
-
return 0
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
`[reporoot]/devenv/config.ini`
|
|
294
|
-
```ini
|
|
295
|
-
[venv.exampleproject]
|
|
296
|
-
python = 3.12.3
|
|
297
|
-
requirements = requirements-dev.txt
|
|
298
|
-
editable =
|
|
299
|
-
.
|
|
300
|
-
|
|
301
|
-
[venv.inhouse-tool]
|
|
302
|
-
python = 3.12.3
|
|
303
|
-
requirements = inhouse-tool/requirements-dev.txt
|
|
304
|
-
|
|
305
|
-
[python3.12.3]
|
|
306
|
-
darwin_x86_64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-x86_64-apple-darwin-install_only.tar.gz
|
|
307
|
-
darwin_x86_64_sha256 = c37a22fca8f57d4471e3708de6d13097668c5f160067f264bb2b18f524c890c8
|
|
308
|
-
darwin_arm64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-aarch64-apple-darwin-install_only.tar.gz
|
|
309
|
-
darwin_arm64_sha256 = ccc40e5af329ef2af81350db2a88bbd6c17b56676e82d62048c15d548401519e
|
|
310
|
-
linux_x86_64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-x86_64-unknown-linux-gnu-install_only.tar.gz
|
|
311
|
-
linux_x86_64_sha256 = a73ba777b5d55ca89edef709e6b8521e3f3d4289581f174c8699adfb608d09d6
|
|
312
|
-
linux_arm64 = https://github.com/astral-sh/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-aarch64-unknown-linux-gnu-install_only.tar.gz
|
|
313
|
-
linux_arm64_sha256 = ec8126de97945e629cca9aedc80a29c4ae2992c9d69f2655e27ae73906ba187d
|
|
314
|
-
```
|
|
315
235
|
|
|
316
236
|
### node
|
|
317
237
|
|
|
@@ -335,16 +255,16 @@ def main(context: dict[str, str]) -> int:
|
|
|
335
255
|
cfg["node"][f"{constants.SYSTEM_MACHINE}_sha256"],
|
|
336
256
|
reporoot,
|
|
337
257
|
)
|
|
338
|
-
|
|
258
|
+
|
|
259
|
+
node.install_pnpm(reporoot)
|
|
339
260
|
|
|
340
261
|
print("installing node dependencies...")
|
|
341
262
|
proc.run(
|
|
342
263
|
(
|
|
343
|
-
"
|
|
264
|
+
f"{reporoot}/.devenv/bin/pnpm",
|
|
344
265
|
"install",
|
|
345
266
|
"--frozen-lockfile",
|
|
346
|
-
"--
|
|
347
|
-
"--non-interactive",
|
|
267
|
+
"--reporter=append-only",
|
|
348
268
|
),
|
|
349
269
|
)
|
|
350
270
|
|
|
@@ -366,7 +286,6 @@ linux_x86_64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-
|
|
|
366
286
|
linux_x86_64_sha256 = efc0f295dd878e510ab12ea36bbadc3db03c687ab30c07e86c7cdba7eed879a9
|
|
367
287
|
# used for autoupdate
|
|
368
288
|
version = v20.13.1
|
|
369
|
-
yarn_version = 1.22.22
|
|
370
289
|
```
|
|
371
290
|
|
|
372
291
|
### brew
|
|
@@ -4,7 +4,7 @@ devenv/__main__.py,sha256=O8ROZOx3emX7hhzMD608Ud_Pny_PCy5RsWXwBLhf8Q8,122
|
|
|
4
4
|
devenv/bootstrap.py,sha256=VSlS1giUv8fE0K5pZgIO-QBKg5PsaWxirF6G9OPUUhE,4047
|
|
5
5
|
devenv/colima.py,sha256=Dk9t6eu2DEoqqkY8xLmgiB96r-6zi3aXcvON3P8h1JQ,1537
|
|
6
6
|
devenv/constants.py,sha256=wl0sRfkNeJL-sML6MG5nS0zU-dwRo1mDPrhUSHHY1YQ,1498
|
|
7
|
-
devenv/doctor.py,sha256=
|
|
7
|
+
devenv/doctor.py,sha256=Qqytk_oYtyQTPqVvRCPHC3c-4_yDOuOqtO2AnmRG8-Y,8728
|
|
8
8
|
devenv/fetch.py,sha256=adDMbqQF19Q_MmunQMMy6n3rBGpUh3ju1Thrt-5OA4I,4078
|
|
9
9
|
devenv/main.py,sha256=grOHjy0kUJjeGW8STg-WMneVYlkTRVMoFjNdIgt7sjg,3267
|
|
10
10
|
devenv/pin_gha.py,sha256=t7A5CV1bnYRa4SAikuoJeodHuwV6moIePvhQ1Zdc1eE,2187
|
|
@@ -14,14 +14,14 @@ devenv/sync.py,sha256=B9bvAuI7K-4SqcfHD4_zwKpozAnHWCNOL-IhVOcc3Zg,1254
|
|
|
14
14
|
devenv/update.py,sha256=hkapWwk5L_sHvGSLoXqs0JVRjNfHN80xf5o8W61tOjs,2710
|
|
15
15
|
devenv/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
devenv/checks/colimaSsh.py,sha256=FCF2y-JrCWWyKVDLDddwuOA1J4NQnKIirxBs8EIbRGk,1363
|
|
17
|
+
devenv/checks/diskfree.py,sha256=JGVUqmEtgc75ZFUXjcJBO7MO_PxIKg0o9SMcmqm8CoU,861
|
|
17
18
|
devenv/checks/dockerConfig.py,sha256=l1xhsN0z3my27_DseXyBq_iVcGSgWKHi6suYOyBoWvo,1929
|
|
18
19
|
devenv/checks/dockerDesktop.py,sha256=ynt8nNQ2DDT2rJDGZ-g7xxc4HErHJV_iqBqYHQtvA7Q,1343
|
|
19
20
|
devenv/checks/limaDns.py,sha256=cHef2czdYYLvQqiM4bxiYtzYw4UVTIXJPwrGW2Kjpxo,1885
|
|
20
|
-
devenv/checks/test.py,sha256=AvxoA2W5qTO2ZpoXmjScLiJxXD3Y_limYp5yTjGSZ9U,701
|
|
21
21
|
devenv/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
devenv/lib/archive.py,sha256=75MjlDuwHVaazbNUr8vJmqTyl4Jz6KRd_fUcpwvPwec,4710
|
|
23
23
|
devenv/lib/brew.py,sha256=_7recvYh-LnUJC0eKnYK7F8AzGRL5bi_Khv0f_mgrlM,1795
|
|
24
|
-
devenv/lib/colima.py,sha256=
|
|
24
|
+
devenv/lib/colima.py,sha256=wsKC0B8zm1s7R4ZicqwH1mT7yd1Fzk26pSewY8Esvtk,7859
|
|
25
25
|
devenv/lib/config.py,sha256=5eXYwM44AJ3w2VfVbCDqchYOL1zAjazNcirtM6kxxGw,3344
|
|
26
26
|
devenv/lib/context.py,sha256=4EDImK9pvTp3FqeNigevC9lbJsgdDO9D1t2_Y4NyPlc,207
|
|
27
27
|
devenv/lib/direnv.py,sha256=HDRUaIR0PMAQYiiTaw3gEQuh6Tdb7BUJmV7dBZdPztM,1325
|
|
@@ -31,7 +31,7 @@ devenv/lib/gcloud.py,sha256=pJ28_L0gUS1lZna-gIHeJPo9bEfSHVXh63CoRQGyAw8,3552
|
|
|
31
31
|
devenv/lib/github.py,sha256=AMtcz6gTVKy7qvCP1zTUdHQlnSM32TVaji0aOXJ_F9A,3463
|
|
32
32
|
devenv/lib/limactl.py,sha256=wMA_Q4DRPjmBPe0JSj1xPwYesFa9MT_vVSdaBAAKn5w,4256
|
|
33
33
|
devenv/lib/modules.py,sha256=shoqgja0b-xzXr601Ryz0JOy3Vxbw53I3cRYezVt77g,859
|
|
34
|
-
devenv/lib/node.py,sha256=
|
|
34
|
+
devenv/lib/node.py,sha256=Rz5A5tep3YEfTfyVnrcAZEZCD6-rmdG4MdgpwRC033E,4119
|
|
35
35
|
devenv/lib/proc.py,sha256=eU7DHIk_66wgkHRmdtKbBKZTa6q4tl9QJbrlnQOQCls,2743
|
|
36
36
|
devenv/lib/repository.py,sha256=cDCgcZ6lw0bcWC6DrcDp3tz_MWObmgAyFq39TeU7YHY,1966
|
|
37
37
|
devenv/lib/rosetta.py,sha256=Lm-tDFut86o6l-Y55d5kTacRHTwrv5MFEymQpy7Qihc,1170
|
|
@@ -70,11 +70,12 @@ tests/lib/test_brew.py,sha256=g2Sz-yg4-212qlsKg0vfHf604bQyRjUElsf3khvXrTQ,5711
|
|
|
70
70
|
tests/lib/test_direnv.py,sha256=GKpEbsHgaRZWevYrsa0oOGQFCsyllCLX1vGdg3igvAc,1551
|
|
71
71
|
tests/lib/test_fs.py,sha256=qhX9CQTTSht1f6ZJfmpsSFICTwPs--h_mLlS_1jnZQg,1670
|
|
72
72
|
tests/lib/test_github.py,sha256=IMEG2cmRaK_PMJprFE_ZMqPnZ0StwWqgznhhT_zVk3U,4526
|
|
73
|
+
tests/lib/test_node.py,sha256=0cmWS-YqTXtQ5p6dk2Hc5qTl8XQGt3CGGfVy1rrsE9k,1082
|
|
73
74
|
tests/lib/test_proc.py,sha256=XH6OnxKPSSm3HvDjYHApputMKwgOE8lYqDuK2vK0Z0U,2626
|
|
74
75
|
tests/lib/test_repository.py,sha256=gUi1lkY7bha5WwZ5xcnENOlFYboVV8TFW1lCESvS0VA,787
|
|
75
76
|
tests/lib/test_venv.py,sha256=3XGpINFBkn6Yq4OycsF-Ki4xMWAINt2g69uOHtkDU6k,3266
|
|
76
|
-
sentry_devenv-1.
|
|
77
|
-
sentry_devenv-1.
|
|
78
|
-
sentry_devenv-1.
|
|
79
|
-
sentry_devenv-1.
|
|
80
|
-
sentry_devenv-1.
|
|
77
|
+
sentry_devenv-1.26.0.dist-info/METADATA,sha256=7HrK8HSN-Q1gmZ5ZcM_UBfZKM_Q3QesAa2zqa461Gfc,12319
|
|
78
|
+
sentry_devenv-1.26.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
79
|
+
sentry_devenv-1.26.0.dist-info/entry_points.txt,sha256=StsIuNugcoEU8jsPy6H9ECjzoDzOVKXl1vUaYTIGbzM,44
|
|
80
|
+
sentry_devenv-1.26.0.dist-info/top_level.txt,sha256=dOQExvIA0fj_EQjCrMTS7CCHNH7WZFHxEU0M7LlNcKQ,16
|
|
81
|
+
sentry_devenv-1.26.0.dist-info/RECORD,,
|
tests/lib/test_node.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pathlib
|
|
5
|
+
from unittest.mock import patch
|
|
6
|
+
|
|
7
|
+
from devenv.lib import node
|
|
8
|
+
from devenv.lib.repository import Repository
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_install_pnpm(tmp_path: pathlib.Path) -> None:
|
|
12
|
+
repo = Repository(f"{tmp_path}/test")
|
|
13
|
+
|
|
14
|
+
binroot = f"{repo.path}/.devenv/bin"
|
|
15
|
+
os.makedirs(binroot)
|
|
16
|
+
open(f"{binroot}/node", "w").close()
|
|
17
|
+
|
|
18
|
+
with patch("devenv.lib.archive.download"), patch(
|
|
19
|
+
"devenv.lib.archive.unpack",
|
|
20
|
+
side_effect=lambda archive_file, tmpd, perform_strip1, strip1_new_prefix: os.makedirs(
|
|
21
|
+
f"{tmpd}/{strip1_new_prefix}"
|
|
22
|
+
),
|
|
23
|
+
), patch("devenv.lib.node.os.path.exists"), patch(
|
|
24
|
+
"devenv.lib.direnv.proc.run", side_effect=["0.0.0"] # node --version
|
|
25
|
+
):
|
|
26
|
+
node.install("0.0.0", "bar", "baz", repo.path)
|
|
27
|
+
|
|
28
|
+
with open(f"{binroot}/npm", "r") as f:
|
|
29
|
+
text = f.read()
|
|
30
|
+
assert (
|
|
31
|
+
text
|
|
32
|
+
== f"""#!/bin/sh
|
|
33
|
+
export PATH={binroot}/node-env/bin:"${{PATH}}"
|
|
34
|
+
export NPM_CONFIG_PREFIX={binroot}/node-env
|
|
35
|
+
exec {binroot}/node-env/bin/npm "$@"
|
|
36
|
+
"""
|
|
37
|
+
)
|
devenv/checks/test.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
|
-
from devenv.lib import fs
|
|
6
|
-
from devenv.lib import proc
|
|
7
|
-
from devenv.lib_check.types import checker
|
|
8
|
-
from devenv.lib_check.types import fixer
|
|
9
|
-
|
|
10
|
-
tags: set[str] = set()
|
|
11
|
-
name = "foo"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@checker
|
|
15
|
-
def check() -> tuple[bool, str]:
|
|
16
|
-
if os.path.exists(f"{fs.gitroot()}/foo"):
|
|
17
|
-
return True, ""
|
|
18
|
-
return False, f"{fs.gitroot()}/foo doesn't exist"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@fixer
|
|
22
|
-
def fix() -> tuple[bool, str]:
|
|
23
|
-
try:
|
|
24
|
-
proc.run(
|
|
25
|
-
(
|
|
26
|
-
"/bin/bash",
|
|
27
|
-
"-c",
|
|
28
|
-
"""
|
|
29
|
-
echo blah > foo
|
|
30
|
-
""",
|
|
31
|
-
),
|
|
32
|
-
cwd=fs.gitroot(),
|
|
33
|
-
)
|
|
34
|
-
return True, ""
|
|
35
|
-
except RuntimeError as e:
|
|
36
|
-
return False, f"{e}"
|
|
File without changes
|
|
File without changes
|