Configurable bootstrap dir (#1772)

Add a `UV_BOOTSTRAP_DIR` option to configure the python bootstrap
directory. This is helpful when working across multiple platforms in a
single IDE session.
This commit is contained in:
konsti 2024-02-21 13:46:23 +01:00 committed by GitHub
parent 5d53040465
commit 0f520d8716
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 6 deletions

View file

@ -30,6 +30,7 @@
import hashlib
import json
import os
import platform
import shutil
import sys
@ -48,7 +49,10 @@ except ImportError:
# Setup some file paths
THIS_DIR = Path(__file__).parent
ROOT_DIR = THIS_DIR.parent.parent
BIN_DIR = ROOT_DIR / "bin"
if bin_dir := os.environ.get("UV_BOOTSTRAP_DIR"):
BIN_DIR = Path(bin_dir)
else:
BIN_DIR = ROOT_DIR / "bin"
INSTALL_DIR = BIN_DIR / "versions"
VERSIONS_FILE = ROOT_DIR / ".python-versions"
VERSIONS_METADATA_FILE = THIS_DIR / "versions.json"