sdist and wheel release fixes (#1758)

* build: fix for universal wheel on python 2.7

* release: fix build order for deploys

The script to build the sdist and wheel packages is run before the
script that uploads them to PyPI. The sdist script doesn't clean up
the environment, but extra prune options have been added to the
MANIFEST.in file (thanks @back-to).

* build: ensure twine/wheel up-to-date and upload sdist/whl separately
This commit is contained in:
beardypig 2018-06-08 03:01:16 +02:00 committed by Forrest
parent 2dca7930a9
commit a14f170a04
5 changed files with 52 additions and 55 deletions

View File

@ -54,15 +54,6 @@ deploy:
tags: true
condition: $BUILD_INSTALLER = yes
repo: streamlink/streamlink
- provider: releases
api_key: "${RELEASES_API_KEY}"
file: "${STREAMLINK_DIST_DIR}/streamlink-${TRAVIS_TAG}*"
file_glob: true
skip_cleanup: true
on:
tags: true
condition: "$BUILD_SDIST = yes"
repo: streamlink/streamlink
- provider: script
script: python script/github_releases.py
skip_cleanup: true
@ -81,10 +72,20 @@ deploy:
repo: streamlink/streamlink
- provider: script
script: ./script/sdistsign.sh
skip_cleanup: true
on:
tags: true
condition: $BUILD_SDIST == yes
repo: streamlink/streamlink
- provider: releases
api_key: "${RELEASES_API_KEY}"
file: "${STREAMLINK_DIST_DIR}/streamlink-${TRAVIS_TAG}*"
file_glob: true
skip_cleanup: true
on:
tags: true
condition: $BUILD_SDIST = yes
repo: streamlink/streamlink
after_deploy:
- if [[ "$BUILD_INSTALLER" == 'yes' && "$TRAVIS_EVENT_TYPE" == 'cron' ]]; then ./script/bintrayupdate.sh; fi

View File

@ -3,10 +3,13 @@ include CHANGELOG.md
include README.md
include LICENSE*
include *requirements.txt
include src/streamlink/_version.py
include versioneer.py
recursive-include docs *
prune docs/_build
recursive-include examples *
recursive-include tests *py
include versioneer.py
include src/streamlink/_version.py
prune docs/_build
prune */__pycache__
global-exclude *.pyc *~ *.bak *.swp *.pyo

View File

@ -13,21 +13,26 @@ if [[ -n "${TRAVIS}" ]]; then
fi
echo "build: Installing twine and wheel" >&2
pip -q install twine wheel
pip -q install -U setuptools twine wheel
echo "build: Building streamlink sdist and wheel" >&2
python setup.py -q sdist bdist_wheel --dist-dir "${dist_dir}"
echo "build: Signing sdist and wheel files" >&2
gpg --homedir "${temp_keyring}" --import "${KEY_FILE}" 2>&1 > /dev/null
gpg --homedir "${temp_keyring}" --trust-model always --default-key "${KEY_ID}" --detach-sign --armor "${dist_dir}/streamlink-${version}.tar.gz"
gpg --homedir "${temp_keyring}" --trust-model always --default-key "${KEY_ID}" --detach-sign --armor "${dist_dir}/streamlink-${version}-py2.py3-none-any.whl"
if [ -f "${KEY_FILE}" ]; then
echo "build: Signing sdist and wheel files" >&2
gpg --homedir "${temp_keyring}" --import "${KEY_FILE}" 2>&1 > /dev/null
gpg --homedir "${temp_keyring}" --trust-model always --default-key "${KEY_ID}" --detach-sign --armor "${dist_dir}/streamlink-${version}.tar.gz"
gpg --homedir "${temp_keyring}" --trust-model always --default-key "${KEY_ID}" --detach-sign --armor "${dist_dir}/streamlink-${version}-py2.py3-none-any.whl"
else
echo "warning: no signing key, files not signed" >&2
fi
if [[ "${DEPLOY_PYPI}" == "yes" ]]; then
echo "build: Uploading sdist and wheel to PyPI" >&2
twine upload --username "${PYPI_USER}" --password "${PYPI_PASSWORD}" \
"${dist_dir}/streamlink-${version}.tar.gz" \
"${dist_dir}/streamlink-${version}.tar.gz.asc" \
"${dist_dir}/streamlink-${version}.tar.gz.asc"
twine upload --username "${PYPI_USER}" --password "${PYPI_PASSWORD}" \
"${dist_dir}/streamlink-${version}-py2.py3-none-any.whl" \
"${dist_dir}/streamlink-${version}-py2.py3-none-any.whl.asc"
fi

View File

@ -1,6 +1,9 @@
[wheel]
universal = 1
[metadata]
license_file = LICENSE
[versioneer]
VCS = git
style = pep440

View File

@ -1,31 +1,31 @@
#!/usr/bin/env python
import codecs
import os
import versioneer
from os import environ
from os import path
from sys import version_info, path as sys_path
from sys import path as sys_path
from setuptools import setup, find_packages
deps = []
import versioneer
if version_info[0] == 2:
deps = [
# Require backport of concurrent.futures on Python 2
deps.append("futures")
if version_info[1] <= 6:
# Require backport of argparse on Python 2.6
deps.append("argparse")
if version_info[1] < 7 or (version_info[1] == 7 and version_info[2] <= 9):
deps.append("urllib3[secure]")
# Require singledispatch on Python <3.4
if version_info[0] == 2 or (version_info[0] == 3 and version_info[1] < 4):
deps.append("singledispatch")
deps.append("requests>=2.2,!=2.12.0,!=2.12.1,!=2.16.0,!=2.16.1,!=2.16.2,!=2.16.3,!=2.16.4,!=2.16.5,!=2.17.1,<3.0")
'futures;python_version<"3.0"',
# Require singledispatch on Python <3.4
'singledispatch;python_version<"3.4"',
"requests>=2.2,!=2.12.0,!=2.12.1,!=2.16.0,!=2.16.1,!=2.16.2,!=2.16.3,!=2.16.4,!=2.16.5,!=2.17.1,<3.0",
'urllib3[secure]<1.23,>=1.21.1;python_version<"3.0"',
"isodate",
"websocket-client",
# Support for SOCKS proxies
"PySocks!=1.5.7,>=1.5.6",
# win-inet-pton is missing a dependency in PySocks, this has been fixed but not released yet
# Required due to missing socket.inet_ntop & socket.inet_pton method in Windows Python 2.x
'win-inet-pton;python_version<"3.0" and platform_system=="Windows"',
# shutil.get_terminal_size and which were added in Python 3.3
'backports.shutil_which;python_version<"3.3"',
'backports.shutil_get_terminal_size;python_version<"3.3"'
]
# for encrypted streams
if environ.get("STREAMLINK_USE_PYCRYPTO"):
@ -34,11 +34,6 @@ else:
# this version of pycryptodome is known to work and has a Windows wheel for py2.7, py3.3-3.6
deps.append("pycryptodome>=3.4.3,<4")
# shutil.get_terminal_size and which were added in Python 3.3
if version_info[0] == 2:
deps.append("backports.shutil_which")
deps.append("backports.shutil_get_terminal_size")
# for localization
if environ.get("STREAMLINK_USE_PYCOUNTRY"):
deps.append("pycountry")
@ -46,17 +41,6 @@ else:
deps.append("iso-639")
deps.append("iso3166")
deps.append("isodate")
deps.append("websocket-client")
# Support for SOCKS proxies
deps.append("PySocks!=1.5.7,>=1.5.6") # requests[socks] uses this version
# win-inet-pton is missing a dependency in PySocks, this has been fixed but not released yet
if os.name == "nt" and version_info < (3, 0):
# Required due to missing socket.inet_ntop & socket.inet_pton method in Windows Python 2.x
deps.append("win-inet-pton")
# When we build an egg for the Win32 bootstrap we don"t want dependency
# information built into it.
if environ.get("NO_DEPS"):
@ -85,7 +69,8 @@ setup(name="streamlink",
"Funding": "https://opencollective.com/streamlink"
},
author="Streamlink",
author_email="charlie@charliedrage.com", # temp until we have a mailing list / global email
# temp until we have a mailing list / global email
author_email="charlie@charliedrage.com",
license="Simplified BSD",
packages=find_packages("src"),
package_dir={"": "src"},