Browse Source

devenv: getsentry sync venv (#65670)

joshuarli 1 year ago
parent
commit
9467bf1aa3
2 changed files with 15 additions and 5 deletions
  1. 10 0
      devenv/config.ini
  2. 5 5
      devenv/sync.py

+ 10 - 0
devenv/config.ini

@@ -7,6 +7,16 @@ editable =
 # sourced by direnv
 # bins =
 
+[venv.getsentry]
+python = 3.11.6
+# technically these are conflicting paths but getsentry is special
+# and would rather keep devenv config symlinked
+path = .venv
+editable = .
+# ideally requirements-getsentry-overrides.txt is compiled into here
+# but we'll just install it during sync as it's rarely populated
+requirements = sentry-requirements-dev-frozen.txt
+
 [python3.11.6]
 darwin_x86_64 = https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-apple-darwin-install_only.tar.gz
 darwin_x86_64_sha256 = 178cb1716c2abc25cb56ae915096c1a083e60abeba57af001996e8bc6ce1a371

+ 5 - 5
devenv/sync.py

@@ -72,9 +72,9 @@ def main(context: dict[str, str]) -> int:
     repo = context["repo"]
     reporoot = context["reporoot"]
 
-    venv_dir, python_version, requirements, editable_paths, bins = venv.get(reporoot, "sentry")
+    venv_dir, python_version, requirements, editable_paths, bins = venv.get(reporoot, repo)
     url, sha256 = config.get_python(reporoot, python_version)
-    print(f"ensuring venv at {venv_dir}...")
+    print(f"ensuring {repo} venv at {venv_dir}...")
     venv.ensure(venv_dir, python_version, url, sha256)
 
     if not run_procs(
@@ -136,12 +136,12 @@ def main(context: dict[str, str]) -> int:
     if not os.path.exists(f"{constants.home}/.sentry/config.yml") or not os.path.exists(
         f"{constants.home}/.sentry/sentry.conf.py"
     ):
-        proc.run((f"{venv_dir}/bin/sentry", "init", "--dev"))
+        proc.run((f"{venv_dir}/bin/{repo}", "init", "--dev"))
 
     # TODO: check healthchecks for redis and postgres to short circuit this
     proc.run(
         (
-            f"{venv_dir}/bin/sentry",
+            f"{venv_dir}/bin/{repo}",
             "devservices",
             "up",
             "redis",
@@ -157,7 +157,7 @@ def main(context: dict[str, str]) -> int:
         (
             (
                 "python migrations",
-                (f"{venv_dir}/bin/sentry", "upgrade", "--noinput"),
+                (f"{venv_dir}/bin/{repo}", "upgrade", "--noinput"),
             ),
         ),
     ):