Skip to content

Commit

Permalink
Isolated issue case and fixed script
Browse files Browse the repository at this point in the history
  • Loading branch information
code-ape committed Dec 21, 2023
1 parent 36da55e commit 832ac6f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 22 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/nexe-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ jobs:
matrix:
# TODO: Bump to windows-latest once it can be solved how to install Python2
# such that the Node.js build system can detect it.
os: [ubuntu-latest, windows-2019, macos-latest]
node_version: ['14.16.0', '14.18.0', '14.18.1', '16.11.0', '16.13.0', '16.13.1', '16.19.0', '18.14.0', '18.19.0']
#os: [ubuntu-latest, windows-2019, macos-latest]
os: [macos-latest]
#node_version: ['14.16.0', '14.18.0', '14.18.1', '16.11.0', '16.13.0', '16.13.1', '16.19.0', '18.14.0', '18.19.0']
node_version: ['18.19.0']

steps:
- uses: actions/checkout@v3
Expand Down
44 changes: 31 additions & 13 deletions bin/build_nexe
Original file line number Diff line number Diff line change
Expand Up @@ -100,28 +100,46 @@ function main(){
cpu_core_count="$(sysctl -n hw.ncpu)"
;;
esac
echo "cpu_core_count=$cpu_core_count"

python2_path="$(which python2)"
python3_path="$(which python3)"
# Get Python installation details
if command -v python2 &> /dev/null; then
python2_path="$(which python2)"
fi
if command -v python3 &> /dev/null; then
python3_path="$(which python3)"
fi
echo "python2_path=$python2_path"
echo "python3_path=$python3_path"
if [ "$python2_path" = "" ] && [ "$python3_path" = "" ]; then
echo "Could NOT find python2 or python3 installation. Exiting!"
exit 1
fi

nexe_part_1_cmd="nexe --build --verbose --no-mangle --target=$nexe_target --make=-j$cpu_core_count"
nexe_part_3_cmd="-o $nexe_no_mangle_path '$repo_dir/index.js'"

echo "console.log('TEST NEXE SCRIPT'); console.log(process.version); var os = require('os'); console.log('os.userInfo() =', os.userInfo());" > "$repo_dir/index.js"
echo "Building $nexe_no_mangle_name (python 3)"
nexe_cmd="$nexe_part_1_cmd --python=$python3_path $nexe_part_3_cmd"
echo " $nexe_cmd"
set +e
time npx $nexe_cmd || build_failed="true"
set -e
if [ "$build_failed" = "true" ]; then
echo "Trying fallback to python2 ..."
echo "Building $nexe_no_mangle_name (python 2)"
nexe_cmd="$nexe_part_1_cmd --python=$python2_path $nexe_part_3_cmd"

if [ "$python3_path" != "" ]; then
echo "Building $nexe_no_mangle_name (python 3)"
nexe_cmd="$nexe_part_1_cmd --python=$python3_path $nexe_part_3_cmd"
echo " $nexe_cmd"
time npx $nexe_cmd
set +e
time npx $nexe_cmd || build_failed="true"
set -e
fi
if [ "$build_failed" = "true" ] && [ "$python2_path" = "" ]; then
echo "No python2 installation found to try. Exiting with error."
exit 1
fi

echo "Trying fallback to python2 ..."
echo "Building $nexe_no_mangle_name (python 2)"
nexe_cmd="$nexe_part_1_cmd --python=$python2_path $nexe_part_3_cmd"
echo " $nexe_cmd"
time npx $nexe_cmd

echo "Build finished."
rm "$repo_dir/index.js"
# Not compressing right now because nexe currently doesn't support downloading
Expand Down
18 changes: 11 additions & 7 deletions bin/install_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ case "$os_env" in
"linux")
echo "Dependencies installed via container (skipping)"
;;
# Temporarily disabling as it was causing build to fail for unknown reasons
#"mac")
# echo "Installing macos dependencies ..."
# set -x
# brew install ccache
# set +x
# ;;
"mac")
echo "Installing macos dependencies ..."
set -x
# Temporarily disabling as it was causing build to fail for unknown reasons
#brew install ccache
brew install pyenv
pyenv install 2.7.18
export PATH="$(pyenv root)/shims:${PATH}"
which python2
set +x
;;
*)
echo "No dependencies to install for '$os_env'"
;;
Expand Down

0 comments on commit 832ac6f

Please sign in to comment.