sentry-devenv 1.17.0__py3-none-any.whl → 1.19.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/credsStore.py +1 -1
- devenv/checks/dockerDesktop.py +47 -0
- devenv/checks/limaDns.py +85 -0
- devenv/colima.py +3 -0
- devenv/doctor.py +9 -9
- devenv/lib/colima.py +11 -0
- {sentry_devenv-1.17.0.dist-info → sentry_devenv-1.19.0.dist-info}/METADATA +1 -1
- {sentry_devenv-1.17.0.dist-info → sentry_devenv-1.19.0.dist-info}/RECORD +12 -10
- {sentry_devenv-1.17.0.dist-info → sentry_devenv-1.19.0.dist-info}/WHEEL +1 -1
- tests/doctor/test_run_checks.py +1 -1
- {sentry_devenv-1.17.0.dist-info → sentry_devenv-1.19.0.dist-info}/entry_points.txt +0 -0
- {sentry_devenv-1.17.0.dist-info → sentry_devenv-1.19.0.dist-info}/top_level.txt +0 -0
devenv/checks/credsStore.py
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
from devenv.lib import proc
|
|
6
|
+
from devenv.lib_check.types import checker
|
|
7
|
+
from devenv.lib_check.types import fixer
|
|
8
|
+
|
|
9
|
+
tags: set[str] = {"builtin"}
|
|
10
|
+
name = "docker desktop shouldn't be running"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def docker_desktop_is_running() -> bool:
|
|
14
|
+
procs = proc.run(("/bin/ps", "-Ac", "-o", "comm"), stdout=True)
|
|
15
|
+
return "Docker Desktop" in procs.split("\n")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@checker
|
|
19
|
+
def check() -> tuple[bool, str]:
|
|
20
|
+
if docker_desktop_is_running():
|
|
21
|
+
return (
|
|
22
|
+
False,
|
|
23
|
+
"Docker Desktop is running. We don't support it, and it conflicts with colima.",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return True, ""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@fixer
|
|
30
|
+
def fix() -> tuple[bool, str]:
|
|
31
|
+
# regular pkill won't stop the Docker Desktop UI,
|
|
32
|
+
# it'll just spin. the proper way to terminate it
|
|
33
|
+
# without SIGKILL is to use osascript.
|
|
34
|
+
print("Attempting to stop Docker Desktop.")
|
|
35
|
+
try:
|
|
36
|
+
proc.run(("osascript", "-e", 'quit app "Docker Desktop"'))
|
|
37
|
+
except RuntimeError as e:
|
|
38
|
+
return False, f"failed to quit Docker Desktop:\n{e}\n"
|
|
39
|
+
|
|
40
|
+
# osascript doesn't wait to make sure it finishes quitting
|
|
41
|
+
# so let's block for up to 5 secs
|
|
42
|
+
for _ in range(10):
|
|
43
|
+
time.sleep(0.5)
|
|
44
|
+
if not docker_desktop_is_running():
|
|
45
|
+
return True, ""
|
|
46
|
+
|
|
47
|
+
return False, "Docker Desktop is taking too long to quit... try again?"
|
devenv/checks/limaDns.py
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from devenv.lib import colima
|
|
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] = {"builtin"}
|
|
11
|
+
name = "colima's DNS isn't working"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@checker
|
|
15
|
+
def check() -> tuple[bool, str]:
|
|
16
|
+
# dns resolution can... stop working if colima's running
|
|
17
|
+
# and wifi changes to some other network that gives macos some
|
|
18
|
+
# weird nameservers
|
|
19
|
+
|
|
20
|
+
status = colima.check()
|
|
21
|
+
if status != colima.ColimaStatus.UP:
|
|
22
|
+
return False, "Colima isn't running."
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
proc.run(
|
|
26
|
+
(
|
|
27
|
+
"colima",
|
|
28
|
+
"exec",
|
|
29
|
+
"--",
|
|
30
|
+
"python3",
|
|
31
|
+
"-Su",
|
|
32
|
+
"-c",
|
|
33
|
+
"""
|
|
34
|
+
import socket
|
|
35
|
+
|
|
36
|
+
try:
|
|
37
|
+
socket.getaddrinfo("ghcr.io", None)
|
|
38
|
+
except socket.gaierror as e:
|
|
39
|
+
raise SystemExit(f"failed to resolve ghcr.io: {e}")
|
|
40
|
+
""",
|
|
41
|
+
),
|
|
42
|
+
stdout=True,
|
|
43
|
+
)
|
|
44
|
+
except RuntimeError as e:
|
|
45
|
+
return False, f"{e}"
|
|
46
|
+
|
|
47
|
+
return True, ""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@fixer
|
|
51
|
+
def fix() -> tuple[bool, str]:
|
|
52
|
+
status = colima.start()
|
|
53
|
+
if status == colima.ColimaStatus.UNHEALTHY:
|
|
54
|
+
return False, "colima started, but it's unhealthy"
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
proc.run(
|
|
58
|
+
(
|
|
59
|
+
"colima",
|
|
60
|
+
"exec",
|
|
61
|
+
"--",
|
|
62
|
+
"sudo",
|
|
63
|
+
"systemctl",
|
|
64
|
+
"restart",
|
|
65
|
+
"systemd-resolved.service",
|
|
66
|
+
),
|
|
67
|
+
stdout=True,
|
|
68
|
+
)
|
|
69
|
+
except RuntimeError as e:
|
|
70
|
+
print(
|
|
71
|
+
f"""
|
|
72
|
+
failed to restart the vm's resolved:
|
|
73
|
+
{e}
|
|
74
|
+
|
|
75
|
+
we're going to try restarting colima
|
|
76
|
+
"""
|
|
77
|
+
)
|
|
78
|
+
try:
|
|
79
|
+
proc.run(
|
|
80
|
+
(sys.executable, "-P", "-m", "devenv", "colima", "restart")
|
|
81
|
+
)
|
|
82
|
+
except RuntimeError as e:
|
|
83
|
+
return False, f"{e}"
|
|
84
|
+
|
|
85
|
+
return True, ""
|
devenv/colima.py
CHANGED
|
@@ -18,6 +18,9 @@ def main(context: Context, argv: Sequence[str] | None = None) -> int:
|
|
|
18
18
|
|
|
19
19
|
args = parser.parse_args(argv)
|
|
20
20
|
|
|
21
|
+
# TODO: in addition to returning 1 we should print colima logs
|
|
22
|
+
# (and/or send to sentry)
|
|
23
|
+
|
|
21
24
|
if args.command == "start":
|
|
22
25
|
status = colima.start()
|
|
23
26
|
if status == colima.ColimaStatus.UNHEALTHY:
|
devenv/doctor.py
CHANGED
|
@@ -143,7 +143,7 @@ def run_checks(
|
|
|
143
143
|
results: dict[Check, tuple[bool, str]] = {}
|
|
144
144
|
for check in checks:
|
|
145
145
|
if check in skip:
|
|
146
|
-
print(f"
|
|
146
|
+
print(f" ⏭️ Skipped {check.name}")
|
|
147
147
|
continue
|
|
148
148
|
futures[check] = executor.submit(check.check)
|
|
149
149
|
for check, future in futures.items():
|
|
@@ -162,9 +162,9 @@ def filter_failing_checks(
|
|
|
162
162
|
for check, result in results.items():
|
|
163
163
|
ok, msg = result
|
|
164
164
|
if ok:
|
|
165
|
-
print(f"
|
|
165
|
+
print(f" ✅ check: {check.name}")
|
|
166
166
|
continue
|
|
167
|
-
print(f"
|
|
167
|
+
print(f" ❌ check: {check.name}\n {msg}")
|
|
168
168
|
failing_checks.append(check)
|
|
169
169
|
return failing_checks
|
|
170
170
|
|
|
@@ -172,7 +172,7 @@ def filter_failing_checks(
|
|
|
172
172
|
def prompt_for_fix(check: Check) -> bool:
|
|
173
173
|
"""Prompt the user to attempt a fix."""
|
|
174
174
|
return input(
|
|
175
|
-
f"
|
|
175
|
+
f" Do you want to attempt to fix {check.name}? (Y/n): "
|
|
176
176
|
).lower() in {"y", "yes", ""}
|
|
177
177
|
|
|
178
178
|
|
|
@@ -229,19 +229,19 @@ def main(context: Context, argv: Sequence[str] | None = None) -> int:
|
|
|
229
229
|
if args.check_only:
|
|
230
230
|
return 1
|
|
231
231
|
|
|
232
|
-
print("\nThe following problems have been identified:")
|
|
233
232
|
skip: list[Check] = []
|
|
233
|
+
print("\nLet's go through the failures one by one.")
|
|
234
234
|
for check in failing_checks:
|
|
235
|
-
print(f"
|
|
235
|
+
print(f"❌ {check.name}")
|
|
236
236
|
# Prompt for fixes one by one, so the user can decide to skip a fix.
|
|
237
237
|
if prompt_for_fix(check):
|
|
238
238
|
ok, msg = attempt_fix(check, executor)
|
|
239
239
|
if ok:
|
|
240
|
-
print(f"
|
|
240
|
+
print(f"✅ fix: {check.name}")
|
|
241
241
|
else:
|
|
242
|
-
print(f"
|
|
242
|
+
print(f"❌ fix: {check.name}{msg}")
|
|
243
243
|
else:
|
|
244
|
-
print(f"
|
|
244
|
+
print(f" ⏭️ Skipping {check.name}")
|
|
245
245
|
skip.append(check)
|
|
246
246
|
|
|
247
247
|
print("\nChecking that fixes worked as expected...")
|
devenv/lib/colima.py
CHANGED
|
@@ -180,6 +180,17 @@ def start(restart: bool = False) -> ColimaStatus:
|
|
|
180
180
|
"colima",
|
|
181
181
|
"start",
|
|
182
182
|
"--verbose",
|
|
183
|
+
# this effectively makes the vm's resolvectl status use:
|
|
184
|
+
# DNS Servers: 8.8.8.8 1.1.1.1 192.168.5.2
|
|
185
|
+
# https://lima-vm.io/docs/config/network/user/
|
|
186
|
+
# 192.168.5.2 is the host, accessible from the vm
|
|
187
|
+
# sometimes using only the host will result in dns breaking
|
|
188
|
+
# for any number of reasons (public wifi that gives you some weird dns server,
|
|
189
|
+
# tethering, vpn, what have you)
|
|
190
|
+
"--dns",
|
|
191
|
+
"8.8.8.8",
|
|
192
|
+
"--dns",
|
|
193
|
+
"1.1.1.1",
|
|
183
194
|
# ideally we keep ~ ro, but currently the "default" vm
|
|
184
195
|
# is shared across repositories, so for ease of use we'll let home rw
|
|
185
196
|
f"--mount=/var/folders:w,/private/tmp/colima:w,{home}:w",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sentry_devenv
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.19.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
|
|
@@ -2,9 +2,9 @@ ci/integration/repo/devenv/sync.py,sha256=mZhOcSeA10BQ5DkDBoSbpjc2rHeRVYEZAZ6zse
|
|
|
2
2
|
devenv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
devenv/__main__.py,sha256=O8ROZOx3emX7hhzMD608Ud_Pny_PCy5RsWXwBLhf8Q8,122
|
|
4
4
|
devenv/bootstrap.py,sha256=VSlS1giUv8fE0K5pZgIO-QBKg5PsaWxirF6G9OPUUhE,4047
|
|
5
|
-
devenv/colima.py,sha256=
|
|
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=tcwXrE2Y7Ued2gAXCXtfFkyXbG9DOi6jVobbq6DnuZs,8663
|
|
8
8
|
devenv/fetch.py,sha256=MbztGFOzBR4KDPG0TVWcQsA4pGXk61zrQXvh-C9xHuk,3904
|
|
9
9
|
devenv/main.py,sha256=JYV1GflML2DOrIhbZq_Vn89dFd0hqOKXxDVSd2GQRgY,3264
|
|
10
10
|
devenv/pin_gha.py,sha256=t7A5CV1bnYRa4SAikuoJeodHuwV6moIePvhQ1Zdc1eE,2187
|
|
@@ -13,12 +13,14 @@ devenv/pythons.py,sha256=ZcjBrkfmQEkiMP217VyTG48cyteJdYG_hoQ6oFKx_CU,1252
|
|
|
13
13
|
devenv/sync.py,sha256=B9bvAuI7K-4SqcfHD4_zwKpozAnHWCNOL-IhVOcc3Zg,1254
|
|
14
14
|
devenv/update.py,sha256=CkshQUvmVVblXdjARgWQKXSe7pwMjSMrPR3gDEesX5c,2402
|
|
15
15
|
devenv/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
devenv/checks/credsStore.py,sha256=
|
|
16
|
+
devenv/checks/credsStore.py,sha256=G0mqzH62w4_3Tc4VG6tssGHFOUiVgp4RSPlYj86zsUc,1153
|
|
17
|
+
devenv/checks/dockerDesktop.py,sha256=ynt8nNQ2DDT2rJDGZ-g7xxc4HErHJV_iqBqYHQtvA7Q,1343
|
|
18
|
+
devenv/checks/limaDns.py,sha256=cHef2czdYYLvQqiM4bxiYtzYw4UVTIXJPwrGW2Kjpxo,1885
|
|
17
19
|
devenv/checks/test.py,sha256=AvxoA2W5qTO2ZpoXmjScLiJxXD3Y_limYp5yTjGSZ9U,701
|
|
18
20
|
devenv/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
21
|
devenv/lib/archive.py,sha256=LlVETRsf3J53yY_8sjL4P8plLNEMKoS9G48kfoVoseA,4503
|
|
20
22
|
devenv/lib/brew.py,sha256=_7recvYh-LnUJC0eKnYK7F8AzGRL5bi_Khv0f_mgrlM,1795
|
|
21
|
-
devenv/lib/colima.py,sha256=
|
|
23
|
+
devenv/lib/colima.py,sha256=8JSAGC2pXthY_h7-AOsW0xgN-kyZq7_fh63-hhYFCIE,7381
|
|
22
24
|
devenv/lib/config.py,sha256=5eXYwM44AJ3w2VfVbCDqchYOL1zAjazNcirtM6kxxGw,3344
|
|
23
25
|
devenv/lib/context.py,sha256=4EDImK9pvTp3FqeNigevC9lbJsgdDO9D1t2_Y4NyPlc,207
|
|
24
26
|
devenv/lib/direnv.py,sha256=HDRUaIR0PMAQYiiTaw3gEQuh6Tdb7BUJmV7dBZdPztM,1325
|
|
@@ -50,7 +52,7 @@ tests/doctor/test_attempt_fix.py,sha256=cGUv7-xRKWCizC9cNNqiCp7aa95k3nHUXvRFFuLf
|
|
|
50
52
|
tests/doctor/test_filter_failing_checks.py,sha256=5L5XdBSyeySwZtJeAR71lbktt3NxkJdUfncKBJPYdAc,1270
|
|
51
53
|
tests/doctor/test_load_checks.py,sha256=C0uIdjftQZokZNYf003pNFfWuT9Gk1C7ALZzN_JnsWQ,2714
|
|
52
54
|
tests/doctor/test_prompt_for_fix.py,sha256=dfFcdZnbkboB2-4vk1iyAHj7sCcsvM4AkBarnU8xBs8,1035
|
|
53
|
-
tests/doctor/test_run_checks.py,sha256=
|
|
55
|
+
tests/doctor/test_run_checks.py,sha256=t03x6ICUPuceTcHUQKBMRTrr0VzRORv9_hZwcnm2v08,2320
|
|
54
56
|
tests/doctor/devenv/checks/bad_check.py,sha256=uohSVSUMnZmj0eFXEwCOHBzCJN6cdjv2hm6_u9ZMEFw,336
|
|
55
57
|
tests/doctor/devenv/checks/bad_fix.py,sha256=dQqUumOOw-YhnbweMXYKeYQFVh1CXZzGMDsO73Uv16Y,335
|
|
56
58
|
tests/doctor/devenv/checks/broken_check.py,sha256=dutNCmaB6COeu8VPMcR_r5hw9Zud0lOXfQG1a5sg8-o,383
|
|
@@ -69,8 +71,8 @@ tests/lib/test_github.py,sha256=IMEG2cmRaK_PMJprFE_ZMqPnZ0StwWqgznhhT_zVk3U,4526
|
|
|
69
71
|
tests/lib/test_proc.py,sha256=XH6OnxKPSSm3HvDjYHApputMKwgOE8lYqDuK2vK0Z0U,2626
|
|
70
72
|
tests/lib/test_repository.py,sha256=gUi1lkY7bha5WwZ5xcnENOlFYboVV8TFW1lCESvS0VA,787
|
|
71
73
|
tests/lib/test_venv.py,sha256=wscU7Enp8fK6o_2HgIT4WwDnvHbKwaKvJhNyJUrDNqk,3262
|
|
72
|
-
sentry_devenv-1.
|
|
73
|
-
sentry_devenv-1.
|
|
74
|
-
sentry_devenv-1.
|
|
75
|
-
sentry_devenv-1.
|
|
76
|
-
sentry_devenv-1.
|
|
74
|
+
sentry_devenv-1.19.0.dist-info/METADATA,sha256=I9mqOnTg4iM8ffcjIKb-grNlcw2KrQCQph6WUzMK5fI,13622
|
|
75
|
+
sentry_devenv-1.19.0.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
|
76
|
+
sentry_devenv-1.19.0.dist-info/entry_points.txt,sha256=StsIuNugcoEU8jsPy6H9ECjzoDzOVKXl1vUaYTIGbzM,44
|
|
77
|
+
sentry_devenv-1.19.0.dist-info/top_level.txt,sha256=dOQExvIA0fj_EQjCrMTS7CCHNH7WZFHxEU0M7LlNcKQ,16
|
|
78
|
+
sentry_devenv-1.19.0.dist-info/RECORD,,
|
tests/doctor/test_run_checks.py
CHANGED
|
@@ -51,7 +51,7 @@ def test_run_checks_skip(capsys: pytest.CaptureFixture[str]) -> None:
|
|
|
51
51
|
[first_check, second_check], ThreadPoolExecutor(), skip=[second_check]
|
|
52
52
|
) == {first_check: (True, "")}
|
|
53
53
|
captured = capsys.readouterr()
|
|
54
|
-
assert captured.out == "
|
|
54
|
+
assert captured.out == " ⏭️ Skipped failing check\n"
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
def test_run_checks_multiple_failing_checks() -> None:
|
|
File without changes
|
|
File without changes
|