Skip to content

Commit

Permalink
[PyPI] Try to use build to make sdist, else fall back to setup.py sdist
Browse files Browse the repository at this point in the history
Also add check for wheel to avoid error during publish.sh
  • Loading branch information
matthewfeickert committed Jan 18, 2022
1 parent 97d2af1 commit 00997a3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packaging/wheel/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ fi
cd $startdir
rm -r xrootdbuild

# TODO: Remove all of the below and build a wheel using PyPA tools

# convert the egg-info into a proper dist-info
egginfo_path=$(ls $1/xrootd-*.egg-info)
core="${egginfo_path%.*}"
Expand Down
33 changes: 32 additions & 1 deletion packaging/wheel/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,35 @@ version=$(./genversion.sh --print-only)
version=${version#v}
echo $version > bindings/python/VERSION
rm -r dist
python3 setup.py sdist

# Determine if wheel.bdist_wheel is available for wheel.bdist_wheel in setup.py
python3 -c 'import wheel' &> /dev/null
wheel_available=$?
if [ "${wheel_available}" -ne "0" ]; then
python3 -m pip install wheel
wheel_available=$?

if [ "${wheel_available}" -ne "0" ]; then
echo "ERROR: Unable to find wheel and unable to install wheel with '$(command -v python3) -m pip install wheel'."
echo " Please ensure wheel is available to $(command -v python3) and try again."
exit 1
fi
fi
unset wheel_available

# Determine if build is available
python3 -c 'import build' &> /dev/null
build_available=$?
if [ "${build_available}" -ne "0" ]; then
python3 -m pip install build
build_available=$?
fi

if [ "${build_available}" -ne "0" ]; then
echo "WARNING: Unable to find build and unable to install build from PyPI with '$(command -v python3) -m pip install build'."
echo " Falling back to building sdist with '$(command -v python3) setup.py sdist'."
python3 setup.py sdist
else
python3 -m build --sdist .
fi
unset build_available

0 comments on commit 00997a3

Please sign in to comment.