Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Windows wheels #191

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
96 changes: 57 additions & 39 deletions .travis.yml
@@ -1,63 +1,81 @@
matrix:
include:
- os: windows
language: sh
python: 3.6
name: Build on Python 3.6.8 in Windows
env: PYVER="3.6.8" CAIRO_VERSION=1.17.2
- os: windows
language: sh
python: 3.7
name: Build on Python 3.7.7 in Windows
env: PYVER="3.7.7" CAIRO_VERSION=1.17.2
- os: windows
language: sh
python: 3.8
name: Build on Python 3.8.3 in Windows
env: PYVER="3.8.3" CAIRO_VERSION=1.17.2
- os: linux
dist: trusty
language: python
python: "3.5"
python: 3.5
name: Build on Python 3.5 in Trusty Linux
env: CFLAGS="-Werror -coverage"
- os: linux
dist: trusty
language: python
python: "3.6"
python: 3.6
name: Build on Python 3.6 in Trusty Linux
env: CFLAGS="-Werror -coverage"
- os: linux
dist: xenial
language: python
python: "3.7"
python: 3.7
name: Build on Python 3.7 in Xenial Linux
env: CFLAGS="-Werror -coverage"
- os: linux
dist: xenial
language: python
python: "3.8"
env: CFLAGS="-Werror -coverage"
- os: linux
dist: xenial
language: python
python: "pypy3"
python: 3.8
name: Build on Python 3.8 in Xenial Linux
env: CFLAGS="-Werror -coverage"
- os: osx
osx_image: xcode11.3
language: generic
name: Build on Python 3.8 in Mac OSX xcode11.3
env: CFLAGS="-Werror -coverage"


install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry sudo apt-get update -q; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_retry sudo apt-get install -y libcairo2-dev; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install pkg-config || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cairo || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python@2 || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python3 -m pip install virtualenv; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then virtualenv ../venv -p python3; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source ../venv/bin/activate; fi
- python -m pip install --upgrade setuptools
- python -m pip install --upgrade pytest flake8 "sphinx<3" sphinx_rtd_theme coverage codecov hypothesis attrs
- python -m pip install --upgrade mypy || true
- if [[ "$TRAVIS_OS_NAME" != "osx" ]] && [[ "$TRAVIS_PYTHON_VERSION" != "3.8" ]] && [[ "${TRAVIS_PYTHON_VERSION:0:4}" != "pypy" ]]; then python -m pip install --upgrade pygame; fi

- if [ "$TRAVIS_OS_NAME" == "linux" ]; then travis_retry sudo apt-get update -q; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then travis_retry sudo apt-get install -y libcairo2-dev; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install pkg-config || true; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install cairo || true; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew unlink python@2 || true; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install python || true; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then python3 -m pip install virtualenv; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then virtualenv ../venv -p python3; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then source ../venv/bin/activate; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python -m pip install --upgrade setuptools; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python -m pip install --upgrade pytest flake8 "sphinx<3" sphinx_rtd_theme coverage codecov hypothesis attrs; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python -m pip install --upgrade mypy || true; fi
script:
- python -m coverage run --branch setup.py test
- python -m codecov --required || true
- python -m flake8 .
- python setup.py sdist
- python setup.py bdist
- python setup.py install --root=_root
- python setup.py install --root="$(pwd)"/_root_abs
- python setup.py bdist_egg
- python setup.py bdist_wheel
- python setup.py install --root=_root_setup
- if [[ "${TRAVIS_PYTHON_VERSION:0:4}" != "pypy" ]] ; then python -m pip install .; fi
- python -m sphinx -W -a -E -b html -n docs docs/_build
#windows build
- if [ "$TRAVIS_OS_NAME" == "windows" ]; then source .travis/runPycairo.sh; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python setup.py sdist; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python setup.py bdist; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python setup.py install --root=_root; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python setup.py install --root="$(pwd)"/_root_abs; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python setup.py bdist_wheel; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python setup.py install --root=_root_setup; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then if [[ "${TRAVIS_PYTHON_VERSION:0:4}" != "pypy" ]] ; then python -m pip install .; fi; fi
- if [ "$TRAVIS_OS_NAME" != "windows" ]; then python -m sphinx -W -a -E -b html -n docs docs/_build; fi

deploy:
if: TRAVIS_OS_NAME = windows
provider: releases
file_glob: true
api_key: $GITHUBOAUTHTOKEN
file: dist/*
skip_cleanup: true
draft: true
28 changes: 28 additions & 0 deletions .travis/runPycairo.sh
@@ -0,0 +1,28 @@
#download cairo
curl -L https://github.com/preshing/cairo-windows/releases/download/$CAIRO_VERSION/cairo-windows-$CAIRO_VERSION.zip -o cairocomplied.zip
7z x cairocomplied.zip
mv cairo-windows-$CAIRO_VERSION cairocomplied
curl -L https://aka.ms/nugetclidl -o nuget.exe
#x64 python begins here
export INCLUDE="$PWD/cairocomplied/include/"
export LIB="$PWD/cairocomplied/lib/x64/"
cp cairocomplied/lib/x64/cairo.dll cairo/cairo.dll
./nuget install python -Version $PYVER -OutputDirectory python
./python/python.$PYVER/tools/python.exe -m pip install --upgrade pip
./python/python.$PYVER/tools/python.exe -m pip install --upgrade wheel
./python/python.$PYVER/tools/python.exe -m pip install --upgrade setuptools
./python/python.$PYVER/tools/python.exe -m pip install pytest
./python/python.$PYVER/tools/python.exe -m pip install --upgrade mypy || true
./python/python.$PYVER/tools/python.exe setup.py bdist_wheel
rm cairo/cairo.dll
#x86 python begins here
./nuget install pythonx86 -Version $PYVER -OutputDirectory pythonx86
cp cairocomplied/lib/x86/cairo.dll cairo/cairo.dll
./pythonx86/pythonx86.$PYVER/tools/python.exe -m pip install --upgrade pip
./pythonx86/pythonx86.$PYVER/tools/python.exe -m pip install --upgrade wheel
./pythonx86/pythonx86.$PYVER/tools/python.exe -m pip install --upgrade setuptools
./pythonx86/pythonx86.$PYVER/tools/python.exe -m pip install pytest
./pythonx86/pythonx86.$PYVER/tools/python.exe -m pip install --upgrade mypy || true
export INCLUDE="$PWD/cairocomplied/include/"
export LIB="$PWD/cairocomplied/lib/x86/"
./pythonx86/pythonx86.$PYVER/tools/python.exe setup.py bdist_wheel
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -579,7 +579,6 @@ def main():
"build_tests": build_tests,
"sdist": sdist,
}

setup(
name="pycairo",
version=PYCAIRO_VERSION,
Expand All @@ -595,6 +594,7 @@ def main():
"cairo": [
"__init__.pyi",
"py.typed",
"cairo.dll",
],
},
classifiers=[
Expand Down