@@ -121,14 +121,14 @@ REQ
121121fi
122122
123123if [ "$1" = "pip" ] && [ "$2" = "install" ]; then
124- target_dir =""
124+ prefix_dir =""
125125 requirements_file=""
126126
127127 while [ "$#" -gt 0 ]; do
128128 case "$1" in
129- --target )
129+ --prefix )
130130 shift
131- target_dir ="$1"
131+ prefix_dir ="$1"
132132 ;;
133133 -r)
134134 shift
@@ -138,9 +138,11 @@ if [ "$1" = "pip" ] && [ "$2" = "install" ]; then
138138 shift || true
139139 done
140140
141- if [ -n "$target_dir" ]; then
142- mkdir -p "$target_dir"
143- touch "$target_dir/fake-installed-package.txt"
141+ if [ -n "$prefix_dir" ]; then
142+ mkdir -p "$prefix_dir/bin"
143+ touch "$prefix_dir/bin/uvicorn"
144+ mkdir -p "$prefix_dir/lib/python3.13/site-packages"
145+ touch "$prefix_dir/lib/python3.13/site-packages/fake-installed-package.txt"
144146 fi
145147
146148 if [ -n "$requirements_file" ]; then
@@ -189,6 +191,8 @@ test_compile_succeeds_for_locked_uv_project() {
189191 local build_dir=" $TEST_ROOT /success/build"
190192 local cache_dir=" $TEST_ROOT /success/cache"
191193 local env_dir=" $TEST_ROOT /success/env"
194+ local package_home=" $build_dir /.python_packages"
195+ local package_bin_dir=" $package_home /bin"
192196 local site_packages_dir=" $build_dir /.python_packages/lib/python3.13/site-packages"
193197 local profile_file=" $build_dir /.profile.d/python.sh"
194198 local export_file=" $build_dir /.uv-export-requirements.txt"
@@ -207,16 +211,18 @@ test_compile_succeeds_for_locked_uv_project() {
207211 assert_contains " $output " " Detected uv project with lockfile. Installing dependencies with uv." " compile should announce supported uv projects"
208212 assert_contains " $output " " Installing Python 3.13 from .python-version." " compile should install the requested Python version"
209213 assert_path_exists " $site_packages_dir " " compile should create the staged site-packages directory"
214+ assert_path_exists " $package_bin_dir /uvicorn" " compile should stage console scripts into the package bin directory"
210215 assert_path_exists " $profile_file " " compile should write a profile script for runtime imports"
211216 assert_path_exists " $export_file " " compile should write the exported requirements file"
212217 assert_path_exists " $shim_dir /python3" " compile should create a python3 shim for runtime commands"
213218 assert_path_exists " $shim_dir /python" " compile should create a python shim for runtime commands"
214219 assert_file_contains " $profile_file " " $site_packages_dir " " profile script should add staged dependencies to PYTHONPATH"
215220 assert_file_contains " $profile_file " " $shim_dir " " profile script should add the managed Python shims to PATH"
221+ assert_file_contains " $profile_file " " $package_bin_dir " " profile script should add staged console scripts to PATH"
216222 assert_file_contains " $TEST_ROOT /uv.log" " python install 3.13" " compile should install the Python version pinned by .python-version"
217223 assert_file_contains " $TEST_ROOT /uv.log" " python find --managed-python 3.13" " compile should resolve the managed interpreter path after installation"
218224 assert_file_contains " $TEST_ROOT /uv.log" " export --locked --format requirements-txt --no-emit-local -o $export_file " " compile should export locked third-party dependencies"
219- assert_file_contains " $TEST_ROOT /uv.log" " pip install --python $FAKE_MANAGED_PYTHON --no-deps --target $site_packages_dir -r $export_file " " compile should install exported dependencies into the staged site-packages directory via uv pip"
225+ assert_file_contains " $TEST_ROOT /uv.log" " pip install --python $FAKE_MANAGED_PYTHON --no-deps --prefix $package_home -r $export_file " " compile should install exported dependencies into the staged prefix via uv pip"
220226}
221227
222228test_compile_adds_src_directory_to_pythonpath_when_present () {
0 commit comments