@@ -71,33 +71,57 @@ for dep in deps:
7171 continue
7272PYEOF
7373
74+ # Uninstall any existing pyprophet installation
75+ echo " Uninstalling any existing pyprophet..."
76+ $PYTHON -m pip uninstall -y pyprophet 2> /dev/null || true
77+
78+ # Move pyprophet source directory OUT of the way completely
79+ echo " Temporarily hiding pyprophet source directory..."
80+ TEMP_BACKUP_DIR=$( mktemp -d)
81+ if [ -d " pyprophet" ]; then
82+ mv pyprophet " ${TEMP_BACKUP_DIR} /pyprophet_src"
83+ fi
84+ if [ -d " packaging" ]; then
85+ mv packaging " ${TEMP_BACKUP_DIR} /packaging_src"
86+ fi
87+
7488# Build pyprophet wheel in a completely isolated temp directory
7589echo " Building pyprophet wheel in isolated directory..."
7690WHEEL_BUILD_DIR=$( mktemp -d)
77- cp -r " ${ORIGINAL_DIR} " /* " ${WHEEL_BUILD_DIR} /" 2> /dev/null || true
91+
92+ # Copy ONLY the files needed for building (not the entire tree)
93+ cp " ${ORIGINAL_DIR} /pyproject.toml" " ${WHEEL_BUILD_DIR} /"
94+ cp " ${ORIGINAL_DIR} /setup.py" " ${WHEEL_BUILD_DIR} /"
95+ cp " ${ORIGINAL_DIR} /README.md" " ${WHEEL_BUILD_DIR} /" 2> /dev/null || true
96+ cp " ${ORIGINAL_DIR} /LICENSE" " ${WHEEL_BUILD_DIR} /" 2> /dev/null || true
97+
98+ # Copy source files
99+ cp -r " ${TEMP_BACKUP_DIR} /pyprophet_src" " ${WHEEL_BUILD_DIR} /pyprophet"
100+
78101cd " ${WHEEL_BUILD_DIR} "
79102
103+ # Build wheel
80104$PYTHON -m pip wheel --no-deps --wheel-dir /tmp/pyprophet_wheels .
81105
82- # Return to original directory and clean up wheel build directory
106+ # Return to original directory
83107cd " ${ORIGINAL_DIR} "
84- rm -rf " ${WHEEL_BUILD_DIR} "
85108
86- # CRITICAL: Remove pyprophet source directory to prevent pip from finding it
87- # and installing in editable mode
88- echo " Temporarily moving pyprophet source directory..."
89- if [ -d " pyprophet" ]; then
90- mv pyprophet pyprophet.bak
91- fi
109+ # Clean up wheel build directory
110+ rm -rf " ${WHEEL_BUILD_DIR} "
92111
93- # Install pyprophet from wheel (this will now go to site-packages)
112+ # Install pyprophet from wheel (now pyprophet source is hidden, so it MUST go to site-packages)
94113echo " Installing pyprophet from wheel to site-packages..."
95- $PYTHON -m pip install --force-reinstall --no-deps /tmp/pyprophet_wheels/pyprophet-* .whl
114+ $PYTHON -m pip install --no-deps --no-cache-dir /tmp/pyprophet_wheels/pyprophet-* .whl
96115
97- # Restore the source directory (we'll need hooks and run_pyprophet.py later)
98- if [ -d " pyprophet.bak" ]; then
99- mv pyprophet.bak pyprophet
116+ # Restore the source directories
117+ echo " Restoring source directories..."
118+ if [ -d " ${TEMP_BACKUP_DIR} /pyprophet_src" ]; then
119+ mv " ${TEMP_BACKUP_DIR} /pyprophet_src" pyprophet
120+ fi
121+ if [ -d " ${TEMP_BACKUP_DIR} /packaging_src" ]; then
122+ mv " ${TEMP_BACKUP_DIR} /packaging_src" packaging
100123fi
124+ rm -rf " ${TEMP_BACKUP_DIR} "
101125
102126# Verify installation is in site-packages, NOT source directory
103127echo " Verifying pyprophet installation..."
127151 echo " ✗ WARNING: NumPy may not be in site-packages!"
128152fi
129153
130- $PYTHON -c " import pandas; print('Pandas imports successfully')"
154+ $PYTHON -c " import pandas; print('✓ Pandas imports successfully')"
131155
132156# Collect compiled extension binaries from the installed package
133157ADD_BINARY_ARGS=()
0 commit comments