build: update build script

Use `build` to build sdist and wheels instead of calling setuptools
directly, which is deprecated.
This commit is contained in:
bastimeyer 2023-01-08 02:37:46 +01:00 committed by Forrest
parent c81ceff571
commit ec42682da8
2 changed files with 14 additions and 16 deletions

View File

@ -132,7 +132,7 @@ jobs:
run: |
./script/install-dependencies.sh
python -m pip install -r docs-requirements.txt
python -m pip install --upgrade Jinja2 wheel twine
python -m pip install --upgrade Jinja2 build wheel twine
- name: Build shell completions
run: ./script/build-shell-completions.sh
- name: Build man page

View File

@ -3,12 +3,10 @@ shopt -s nullglob
set -e
for dep in setuptools wheel; do
if ! python -m pip -q show "${dep}"; then
echo "build: missing dependency '${dep}'" >&2;
exit 1;
fi
done
if ! python -m pip -q show "build"; then
echo >&2 "build: missing dependency 'build'"
exit 1
fi
KEY_ID=${SIGNING_KEY_ID:-2E390FA0}
@ -22,20 +20,20 @@ wheel_platforms_windows=("win32" "win-amd64")
mkdir -p "${dist_dir}"
echo "build: Building Streamlink sdist" >&2
python setup.py sdist --dist-dir "${dist_dir}"
echo >&2 "build: Building Streamlink sdist"
python -m build --outdir "${dist_dir}" --sdist
echo "build: Building Streamlink bdist_wheel" >&2
python setup.py bdist_wheel --dist-dir "${dist_dir}"
echo >&2 "build: Building Streamlink wheel"
python -m build --outdir "${dist_dir}" --wheel
for platform in "${wheel_platforms_windows[@]}"; do
echo "build: Building Streamlink bdist_wheel (${platform})" >&2
python setup.py bdist_wheel --plat-name "${platform}" --dist-dir "${dist_dir}"
echo >&2 "build: Building Streamlink wheel (${platform})"
python -m build --outdir "${dist_dir}" --wheel --config-setting="--build-option=--plat-name=${platform}"
done
if [[ "${CI}" = true ]] || [[ -n "${GITHUB_ACTIONS}" ]]; then
echo "build: Decrypting signing key" >&2
echo >&2 "build: Decrypting signing key"
gpg --quiet --batch --yes --decrypt \
--passphrase="${RELEASE_KEY_PASSPHRASE}" \
--output "${KEY_FILE}" \
@ -43,9 +41,9 @@ if [[ "${CI}" = true ]] || [[ -n "${GITHUB_ACTIONS}" ]]; then
fi
if ! [[ -f "${KEY_FILE}" ]]; then
echo "warning: No signing key, files not signed" >&2
echo >&2 "warning: No signing key, files not signed"
else
echo "build: Signing sdist and wheel files" >&2
echo >&2 "build: Signing sdist and wheel files"
temp_keyring=$(mktemp -d) && trap "rm -rf ${temp_keyring}" EXIT || exit 255
gpg --homedir "${temp_keyring}" --import "${KEY_FILE}" 2>&1 >/dev/null
for file in "${dist_dir}"/streamlink-"${version}"{.tar.gz,-*.whl}; do