build sdist/wheel only once for both Github and PyPI
This makes sure we upload the same files to Github Releases and PyPI. Currently we were building them twice, with the risk of different files being uploaded to the two repositories.
This commit is contained in:
parent
9a28b61e3c
commit
61ab1e7f6d
@ -59,7 +59,8 @@ deploy:
|
|||||||
user: anthrotype
|
user: anthrotype
|
||||||
password:
|
password:
|
||||||
secure: Dz3x8kh4ergBV6qZUgcGVDOEzjoCEFzzQiO5WVw4Zfi04DD8+d1ghmMz2BY4UvoVKSsFrfKDuEB3MCWyqewJsf/zoZQczk/vnWVFjERROieyO1Ckzpz/WkCvbjtniIE0lxzB7zorSV+kGI9VigGAaRlXJyU7mCFojeAFqD6cjS4=
|
secure: Dz3x8kh4ergBV6qZUgcGVDOEzjoCEFzzQiO5WVw4Zfi04DD8+d1ghmMz2BY4UvoVKSsFrfKDuEB3MCWyqewJsf/zoZQczk/vnWVFjERROieyO1Ckzpz/WkCvbjtniIE0lxzB7zorSV+kGI9VigGAaRlXJyU7mCFojeAFqD6cjS4=
|
||||||
distributions: "sdist bdist_wheel"
|
skip_cleanup: true
|
||||||
|
distributions: pass
|
||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
repo: fonttools/fonttools
|
repo: fonttools/fonttools
|
||||||
|
@ -3,7 +3,13 @@
|
|||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
if [[ $BUILD_DIST == true ]]; then
|
# build sdist and wheel distribution packages in ./dist folder.
|
||||||
python -m pip install --upgrade wheel
|
# Travis runs the `before_deploy` stage before each deployment, but
|
||||||
python setup.py sdist bdist_wheel
|
# we only want to build them once, as we want to use the same
|
||||||
|
# files for both Github and PyPI
|
||||||
|
if $(ls ./dist/fonttools*.zip > /dev/null 2>&1) && \
|
||||||
|
$(ls ./dist/fonttools*.whl > /dev/null 2>&1); then
|
||||||
|
echo "Distribution packages already exists; skipping"
|
||||||
|
else
|
||||||
|
tox -e bdist
|
||||||
fi
|
fi
|
||||||
|
21
setup.py
21
setup.py
@ -239,6 +239,26 @@ class release(Command):
|
|||||||
return u"".join(changes)
|
return u"".join(changes)
|
||||||
|
|
||||||
|
|
||||||
|
class PassCommand(Command):
|
||||||
|
""" This is used with Travis `dpl` tool so that it skips creating sdist
|
||||||
|
and wheel packages, but simply uploads to PyPI the files found in ./dist
|
||||||
|
folder, that were previously built inside the tox 'bdist' environment.
|
||||||
|
This ensures that the same files are uploaded to Github Releases and PyPI.
|
||||||
|
"""
|
||||||
|
|
||||||
|
description = "do nothing"
|
||||||
|
user_options = []
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="fonttools",
|
name="fonttools",
|
||||||
version="3.4.1.dev0",
|
version="3.4.1.dev0",
|
||||||
@ -272,6 +292,7 @@ setup(
|
|||||||
},
|
},
|
||||||
cmdclass={
|
cmdclass={
|
||||||
"release": release,
|
"release": release,
|
||||||
|
'pass': PassCommand,
|
||||||
},
|
},
|
||||||
**classifiers
|
**classifiers
|
||||||
)
|
)
|
||||||
|
20
tox.ini
20
tox.ini
@ -44,3 +44,23 @@ ignore_outcome = true
|
|||||||
commands =
|
commands =
|
||||||
coverage combine
|
coverage combine
|
||||||
codecov --env TOXENV
|
codecov --env TOXENV
|
||||||
|
|
||||||
|
[testenv:bdist]
|
||||||
|
basepython = {env:TOXPYTHON:python3.5}
|
||||||
|
deps =
|
||||||
|
setuptools
|
||||||
|
wheel
|
||||||
|
skip_install = true
|
||||||
|
install_command =
|
||||||
|
# make sure we use the latest setuptools and wheel
|
||||||
|
pip install --upgrade {opts} {packages}
|
||||||
|
whitelist_externals =
|
||||||
|
rm
|
||||||
|
commands =
|
||||||
|
# clean up build/ and dist/ folders
|
||||||
|
rm -rf {toxinidir}/dist
|
||||||
|
python setup.py clean --all
|
||||||
|
# build sdist
|
||||||
|
python setup.py sdist --dist-dir {toxinidir}/dist
|
||||||
|
# build wheel from sdist
|
||||||
|
pip wheel -v --no-deps --no-index --wheel-dir {toxinidir}/dist --find-links {toxinidir}/dist fonttools
|
||||||
|
Loading…
x
Reference in New Issue
Block a user