|
1 | 1 | #!/usr/bin/env bash |
| 2 | +# filepath: /workspaces/pyprophet/scripts/build/build_linux.sh |
2 | 3 | # Build script for PyProphet Linux executable using PyInstaller |
3 | 4 |
|
4 | 5 | set -euo pipefail |
@@ -80,18 +81,24 @@ for so in "${SITE_PACKAGES}"/pyprophet/scoring/_optimized*.so; do |
80 | 81 | fi |
81 | 82 | done |
82 | 83 |
|
83 | | -# Clean previous PyInstaller builds |
| 84 | +# Save the original directory |
| 85 | +ORIGINAL_DIR="$(pwd)" |
| 86 | + |
| 87 | +# Clean previous PyInstaller builds in original directory |
84 | 88 | rm -rf build dist pyprophet.spec |
85 | 89 |
|
| 90 | +# Create dist directory in original location |
| 91 | +mkdir -p "${ORIGINAL_DIR}/dist" |
| 92 | + |
86 | 93 | # Change to a temporary directory to avoid picking up source files |
87 | 94 | # This ensures PyInstaller only sees installed packages |
88 | 95 | BUILD_DIR=$(mktemp -d) |
89 | 96 | echo "Using temporary build directory: ${BUILD_DIR}" |
90 | 97 | cd "${BUILD_DIR}" |
91 | 98 |
|
92 | 99 | # Copy only the necessary files |
93 | | -cp "${OLDPWD}/packaging/pyinstaller/run_pyprophet.py" . |
94 | | -cp -r "${OLDPWD}/packaging/pyinstaller/hooks" . |
| 100 | +cp "${ORIGINAL_DIR}/packaging/pyinstaller/run_pyprophet.py" . |
| 101 | +cp -r "${ORIGINAL_DIR}/packaging/pyinstaller/hooks" . |
95 | 102 |
|
96 | 103 | # Run PyInstaller in onefile mode (single executable) |
97 | 104 | echo "Running PyInstaller (onefile mode)..." |
@@ -131,10 +138,11 @@ $PYTHON -m PyInstaller \ |
131 | 138 | run_pyprophet.py |
132 | 139 |
|
133 | 140 | # Move the built executable back to the original directory |
134 | | -mv dist/pyprophet "${OLDPWD}/dist/" |
| 141 | +echo "Moving executable to ${ORIGINAL_DIR}/dist/" |
| 142 | +mv dist/pyprophet "${ORIGINAL_DIR}/dist/pyprophet" |
135 | 143 |
|
136 | 144 | # Return to original directory |
137 | | -cd "${OLDPWD}" |
| 145 | +cd "${ORIGINAL_DIR}" |
138 | 146 |
|
139 | 147 | # Clean up temporary build directory and wheel directory |
140 | 148 | rm -rf "${BUILD_DIR}" /tmp/pyprophet_wheels |
|
0 commit comments