lol
at master 58 lines 2.1 kB view raw
1diff --git a/src/hatch/env/virtual.py b/src/hatch/env/virtual.py 2index 285edb32..90bd94e6 100644 3--- a/src/hatch/env/virtual.py 4+++ b/src/hatch/env/virtual.py 5@@ -106,26 +106,7 @@ class VirtualEnvironment(EnvironmentInterface): 6 if self.explicit_uv_path: 7 return self.explicit_uv_path 8 9- from hatch.env.internal import is_default_environment 10- 11- env_name = 'hatch-uv' 12- if not ( 13- # Prevent recursive loop 14- self.name == env_name 15- # Only if dependencies have been set by the user 16- or is_default_environment(env_name, self.app.project.config.internal_envs[env_name]) 17- ): 18- uv_env = self.app.get_environment(env_name) 19- self.app.prepare_environment(uv_env) 20- with uv_env: 21- return self.platform.modules.shutil.which('uv') 22- 23- import sysconfig 24- 25- scripts_dir = sysconfig.get_path('scripts') 26- old_path = os.environ.get('PATH', os.defpath) 27- new_path = f'{scripts_dir}{os.pathsep}{old_path}' 28- return self.platform.modules.shutil.which('uv', path=new_path) 29+ return '@uv@' 30 31 @staticmethod 32 def get_option_types() -> dict: 33diff --git a/src/hatch/venv/core.py b/src/hatch/venv/core.py 34index d1303f03..e1e60871 100644 35--- a/src/hatch/venv/core.py 36+++ b/src/hatch/venv/core.py 37@@ -131,7 +131,7 @@ class TempVirtualEnv(VirtualEnv): 38 39 class UVVirtualEnv(VirtualEnv): 40 def create(self, python, *, allow_system_packages=False): 41- command = [os.environ.get('HATCH_UV', 'uv'), 'venv', str(self.directory), '--python', python] 42+ command = [os.environ.get('HATCH_UV', '@uv@'), 'venv', str(self.directory), '--python', python] 43 if allow_system_packages: 44 command.append('--system-site-packages') 45 46diff --git a/tests/conftest.py b/tests/conftest.py 47index e8fe663a..6066316d 100644 48--- a/tests/conftest.py 49+++ b/tests/conftest.py 50@@ -203,7 +203,7 @@ def python_on_path(): 51 52 @pytest.fixture(scope='session', autouse=True) 53 def uv_on_path(): 54- return shutil.which('uv') 55+ return '@uv@' 56 57 58 @pytest.fixture(scope='session')