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 2 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
108 changes: 69 additions & 39 deletions .travis.yml
@@ -1,63 +1,93 @@
matrix:
include:
- os: windows
language: sh
python: 3.6
name: Build on Python 3.6.8 in Windows
env: PYVER="3.6.8" PYDIR="Python36" INCLUDE="$PWD/cairocomplied/include/" LIB="$PWD/cairocomplied/lib/x64/" CAIRO_VERSION=1.15.12 WHEELSNAMEx32="pycairo-1.19.2-cp36-cp36m-win32.whl" WHEELSNAMEx64="pycairo-1.19.2-cp36-cp36m-win_amd64.whl"
naveen521kk marked this conversation as resolved.
Show resolved Hide resolved
- os: windows
language: sh
python: 3.7
name: Build on Python 3.7.7 in Windows
env: PYVER="3.7.7" PYDIR="Python37" INCLUDE="$PWD/cairocomplied/include/" LIB="$PWD/cairocomplied/lib/x64/" CAIRO_VERSION=1.15.12 WHEELSNAMEx32="pycairo-1.19.2-cp37-cp37m-win32.whl" WHEELSNAMEx64="pycairo-1.19.2-cp37-cp37m-win_amd64.whl"
- os: windows
language: sh
python: 3.8
name: Build on Python 3.8.3 in Windows
env: PYVER="3.8.3" PYDIR="Python38" INCLUDE="$PWD/cairocomplied/include/" LIB="$PWD/cairocomplied/lib/x64/" PYNAME="3.8" CAIRO_VERSION=1.15.12 WHEELSNAMEx32="pycairo-1.19.2-cp38-cp38-win32.whl" WHEELSNAMEx64="pycairo-1.19.2-cp38-cp38-win_amd64.whl"
- 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" == "windows" ]; then source .travis/downloadCairo.sh; 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/runPycairox64.sh; fi
- if [ "$TRAVIS_OS_NAME" == "windows" ]; then source .travis/runPycairox86.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

cache:
directories:
- $HOME/.cache/pip
- $HOME/Library/Caches/Homebrew

before_cache:
- brew cleanup
- rm -f $HOME/.cache/pip/log/debug.log
branches:
naveen521kk marked this conversation as resolved.
Show resolved Hide resolved
only:
- /pycairo-\d.\d{2}/
deploy:
provider: releases
file_glob: true
api_key: $GITHUBOAUTHTOKEN
file: dist/*
skip_cleanup: true
draft: true
4 changes: 4 additions & 0 deletions .travis/downloadCairo.sh
@@ -0,0 +1,4 @@

curl -L https://github.com/preshing/cairo-windows/releases/download/$CAIRO_VERSION/cairo-windows-$CAIRO_VERSION.zip -o cairocomplied.zip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an outdated cairo release :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing we can do now is to compile Cairo if we need the latest one. And btw the install script in cairo-windows is actually batch which Travis doesn't support :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. It's probably best to wait until https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/37 is merged and then build it ourselves using meson. But, yeah, let's not block this..

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. It's probably best to wait until https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/37 is merged and then build it ourselves using meson. But, yeah, let's not block this..

FYI: It's been merged.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea that we would use meson to do the builds here, or is there some buildfarm attached to freedesk that we get the builds from ?

OT (ish)
About a week ago, I had a chat with dependencies.io and they came up with a patch that uses their bot to generate PRs to update cairo + freedesktop, for preshing, cairo when upstream changes. This isn't so relevant if we don't use preshing cairo, but I guess we can still setup something to generate PRs here when upstream updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SO what should be done?

7z x cairocomplied.zip
mv cairo-windows-$CAIRO_VERSION cairocomplied
15 changes: 15 additions & 0 deletions .travis/runPycairox64.sh
@@ -0,0 +1,15 @@

cp cairocomplied/lib/x64/cairo.dll cairo/cairo.dll
choco install python --version=$PYVER
export PATH="/c/$PYDIR:/c/$PYDIR/Scripts:$PATH"
cmd.exe //c "RefreshEnv.cmd"
python -m pip install --upgrade pip
python -m pip install --upgrade wheel
python -m pip install --upgrade setuptools
python -m pip install pytest
python -m pip install --upgrade mypy || true
cmd.exe //c "RefreshEnv.cmd"
python setup.py bdist_wheel
pip install dist/$WHEELSNAMEx64
python testcairo.py
rm -f cairo/cairo.dll
12 changes: 12 additions & 0 deletions .travis/runPycairox86.sh
@@ -0,0 +1,12 @@
cp cairocomplied/lib/x86/cairo.dll cairo/cairo.dll
curl -L https://aka.ms/nugetclidl -o nuget.exe
./nuget install pythonx86 -Version $PYVER -OutputDirectory pythonx86
./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/"
cmd.exe //c "RefreshEnv.cmd"
./pythonx86/pythonx86.$PYVER/tools/python.exe setup.py bdist_wheel
103 changes: 69 additions & 34 deletions setup.py
Expand Up @@ -5,6 +5,7 @@
import sys
import os
import errno
import platform

try:
from setuptools import setup
Expand Down Expand Up @@ -579,41 +580,75 @@ def main():
"build_tests": build_tests,
"sdist": sdist,
}

setup(
name="pycairo",
version=PYCAIRO_VERSION,
url="https://pycairo.readthedocs.io",
description="Python interface for cairo",
long_description=long_description,
maintainer="Christoph Reiter",
maintainer_email="reiter.christoph@gmail.com",
license="LGPL-2.1-only OR MPL-1.1",
ext_modules=[cairo_ext],
packages=["cairo"],
package_data={
"cairo": [
"__init__.pyi",
"py.typed",
if platform.system() == "Windows":
naveen521kk marked this conversation as resolved.
Show resolved Hide resolved
setup(
name="pycairo",
version=PYCAIRO_VERSION,
url="https://pycairo.readthedocs.io",
description="Python interface for cairo",
long_description=long_description,
maintainer="Christoph Reiter",
maintainer_email="reiter.christoph@gmail.com",
license="LGPL-2.1-only OR MPL-1.1",
ext_modules=[cairo_ext],
packages=["cairo"],
package_data={
"cairo": [
"__init__.pyi",
"py.typed",
"cairo.dll",
],
},
classifiers=[
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
('License :: OSI Approved :: '
'GNU Lesser General Public License v2 (LGPLv2)'),
'License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)',
],
},
classifiers=[
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
('License :: OSI Approved :: '
'GNU Lesser General Public License v2 (LGPLv2)'),
'License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)',
],
cmdclass=cmdclass,
python_requires='>=3.5, <4',
)

cmdclass=cmdclass,
python_requires='>=3.5, <4',
)
else:
setup(
name="pycairo",
version=PYCAIRO_VERSION,
url="https://pycairo.readthedocs.io",
description="Python interface for cairo",
long_description=long_description,
maintainer="Christoph Reiter",
maintainer_email="reiter.christoph@gmail.com",
license="LGPL-2.1-only OR MPL-1.1",
ext_modules=[cairo_ext],
packages=["cairo"],
package_data={
"cairo": [
"__init__.pyi",
"py.typed",
],
},
classifiers=[
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
('License :: OSI Approved :: '
'GNU Lesser General Public License v2 (LGPLv2)'),
'License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)',
],
cmdclass=cmdclass,
python_requires='>=3.5, <4',
)

if __name__ == "__main__":
main()