sentry-devenv 1.24.0__py3-none-any.whl → 1.25.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/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 < 14:
107
+ if macos_major_version < 15:
108
108
  raise SystemExit(
109
- f"macos >= 14 is required to use colima, found {macos_version}"
109
+ f"macos >= 15 is required to use colima, found {macos_version}"
110
110
  )
111
111
 
112
112
  docker_executable = shutil.which("docker")
@@ -196,7 +196,8 @@ def start(restart: bool = False) -> ColimaStatus:
196
196
  "1.1.1.1",
197
197
  # ideally we keep ~ ro, but currently the "default" vm
198
198
  # 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/:w",
199
+ f"--mount=/var/folders:w,/private/tmp/colima:w,{home}:w,/tmp/sentry-profiles:w",
200
+ # note: it is not allowed by lima to add top-level root directories like /tmp!
200
201
  *args,
201
202
  ),
202
203
  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", "yarn", "pnpm")
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, "yarn"):
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 yarn
85
- # puts yarn into our node-env.
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.24.0
3
+ Version: 1.25.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
@@ -335,16 +335,16 @@ def main(context: dict[str, str]) -> int:
335
335
  cfg["node"][f"{constants.SYSTEM_MACHINE}_sha256"],
336
336
  reporoot,
337
337
  )
338
- node.install_yarn(cfg["node"]["yarn_version"], reporoot)
338
+
339
+ node.install_pnpm(reporoot)
339
340
 
340
341
  print("installing node dependencies...")
341
342
  proc.run(
342
343
  (
343
- ".devenv/bin/yarn",
344
+ f"{reporoot}/.devenv/bin/pnpm",
344
345
  "install",
345
346
  "--frozen-lockfile",
346
- "--no-progress",
347
- "--non-interactive",
347
+ "--reporter=append-only",
348
348
  ),
349
349
  )
350
350
 
@@ -366,7 +366,6 @@ linux_x86_64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-
366
366
  linux_x86_64_sha256 = efc0f295dd878e510ab12ea36bbadc3db03c687ab30c07e86c7cdba7eed879a9
367
367
  # used for autoupdate
368
368
  version = v20.13.1
369
- yarn_version = 1.22.22
370
369
  ```
371
370
 
372
371
  ### brew
@@ -21,7 +21,7 @@ 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=xd9EpysU2JlD0mD8rDv78QeetaUs7q4HOJXxXnAb1Mc,7534
24
+ devenv/lib/colima.py,sha256=vK1QItRGg8C46m0krtApvBsu3Op5FeuroHCZSIirZPw,7640
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=sp5QbExF0H03UnfLUmFown42_NhyPWKw0H776W7987U,4160
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.24.0.dist-info/METADATA,sha256=w5wVhVx5bE8mhGjpkyNegoQxclAtzbdL9zsac6fytew,15500
77
- sentry_devenv-1.24.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
78
- sentry_devenv-1.24.0.dist-info/entry_points.txt,sha256=StsIuNugcoEU8jsPy6H9ECjzoDzOVKXl1vUaYTIGbzM,44
79
- sentry_devenv-1.24.0.dist-info/top_level.txt,sha256=dOQExvIA0fj_EQjCrMTS7CCHNH7WZFHxEU0M7LlNcKQ,16
80
- sentry_devenv-1.24.0.dist-info/RECORD,,
77
+ sentry_devenv-1.25.0.dist-info/METADATA,sha256=mr9-PPOWcU4UtufPHtYt9_8JYT82XI4CIjLJFNh0w0A,15437
78
+ sentry_devenv-1.25.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
+ sentry_devenv-1.25.0.dist-info/entry_points.txt,sha256=StsIuNugcoEU8jsPy6H9ECjzoDzOVKXl1vUaYTIGbzM,44
80
+ sentry_devenv-1.25.0.dist-info/top_level.txt,sha256=dOQExvIA0fj_EQjCrMTS7CCHNH7WZFHxEU0M7LlNcKQ,16
81
+ sentry_devenv-1.25.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
+ )