Skip to content

Commit 239e794

Browse files
authored
Merge 78e7251 into 985f054
2 parents 985f054 + 78e7251 commit 239e794

15 files changed

+585
-120
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "ci/multibuild"]
2+
path = ci/multibuild
3+
url = https://github.com/matthew-brett/multibuild

.travis.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
env:
2+
global:
3+
- REPO_DIR=.
4+
# Commit from your-project that you want to build
5+
#- BUILD_COMMIT=v0.1.0
6+
# pip dependencies to _build_ your project
7+
#- BUILD_DEPENDS="Cython numpy"
8+
# pip dependencies to _test_ your project. Include any dependencies
9+
# that you need, that are also specified in BUILD_DEPENDS, this will be
10+
# a separate install.
11+
- TEST_DEPENDS="pytest"
12+
- PLAT=x86_64
13+
- CONFIG_PATH="ci/multibuild_config.sh"
14+
15+
language: python
16+
# The travis Python version is unrelated to the version we build and test
17+
# with. This is set with the MB_PYTHON_VERSION variable.
18+
python: 3.5
19+
sudo: required
20+
dist: trusty
21+
services: docker
22+
23+
cache:
24+
directories:
25+
- $HOME/.ccache
26+
27+
matrix:
28+
exclude:
29+
# Exclude the default Python 3.5 build
30+
- python: 3.5
31+
include:
32+
- os: linux
33+
env:
34+
- MB_PYTHON_VERSION=2.7
35+
- PLAT=i686
36+
- USE_CCACHE=1
37+
- FREETYPEPY_BUNDLE_FT=1
38+
- os: linux
39+
env:
40+
- MB_PYTHON_VERSION=3.6
41+
- USE_CCACHE=1
42+
- FREETYPEPY_BUNDLE_FT=1
43+
- os: linux # No bundling.
44+
env:
45+
- MB_PYTHON_VERSION=3.6
46+
- USE_CCACHE=1
47+
- os: osx
48+
language: generic
49+
env:
50+
- MB_PYTHON_VERSION=3.6
51+
- FREETYPEPY_BUNDLE_FT=1
52+
53+
before_install:
54+
- source ci/multibuild/common_utils.sh
55+
- source ci/multibuild/travis_steps.sh
56+
- before_install
57+
58+
install:
59+
- build_wheel $REPO_DIR $PLAT
60+
61+
script:
62+
- install_run $PLAT
63+
64+
after_success:
65+
# copy compiled wheels to dist/ where Travis `dpl` tool can find them and
66+
# upload to PyPI
67+
- if [ -n "$TRAVIS_TAG" ]; then mkdir -p dist; cp wheelhouse/*.whl dist; fi
68+
69+
deploy:
70+
# Deploy to PyPI on tags. Since the hard work of building wheels is already
71+
# done, we need to defeat some of Travis' automation.
72+
provider: pypi
73+
on:
74+
repo: rougier/freetype-py # Prevent triggering from forks.
75+
tags: true
76+
all_branches: true
77+
user: xxx
78+
password:
79+
secure: xxx
80+
skip_cleanup: true # Prevent deletion of dist/*.
81+
distributions: check # Dummy argument so dists aren't rebuilt by dpl.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ recursive-include examples *
88
include MANIFEST.in
99
include LICENSE.txt
1010
include README.rst
11+
include setup-build-freetype.py

README.rst

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,71 @@
1-
FreeType high-level python API
2-
==============================
1+
FreeType (high-level Python API)
2+
================================
33

4-
Freetype python provides bindings for the FreeType library. Only the high-level API is bound.
4+
Freetype Python provides bindings for the FreeType library. Only the
5+
high-level API is bound.
56

67
Documentation available at: http://freetype-py.readthedocs.org/en/latest/
78

89
Installation
910
============
1011

11-
To be able to use freetype python, you need the freetype library version 2
12-
installed on your system.
12+
**From PyPI, recommended**: `pip install freetype-py`. This will install the
13+
library with a bundled FreeType binary, so you're ready to go on Windows,
14+
macOS and Linux (all with 32 and 64 bit x86 architecture support).
15+
16+
Do note: if you specify the `--no-binary` paramater to pip, or use a different
17+
architecture for which we don't pre-compile binaries, the package will default
18+
to using an external FreeType library. Specify the environment variable
19+
`FREETYPEPY_BUNDLE_FT=1` before calling pip to compile a binary yourself.
20+
21+
Installation with compiling FreeType from source
22+
------------------------------------------------
23+
24+
If you don't want to or can't use the pre-built binaries, build FreeType
25+
yourself: `export FREETYPEPY_BUNDLE_FT=yesplease && pip install .`.
26+
This will download and compile FreeType with Harfbuzz support as specified in
27+
`setup-build-freetype.py`. Set the environment variable `PYTHON_ARCH` to 32 or
28+
64 to explicitly set an architecture, default is whatever your host machine
29+
uses. On macOS, we will always build a universal 32 and 64 bit Intel binary.
30+
31+
- Windows: You need CMake and a C and C++ compiler, e.g. the Visual Code
32+
Community 2017 distribution with the desktop C++ workload.
33+
- macOS: You need CMake and the XCode tools (full IDE not necessary)
34+
- Linux: You need CMake, gcc and g++. For building a 32 bit library on a
35+
64 bit machine, you need gcc-multilib and g++-multilib (Debian) or
36+
glibc-devel.i686 and libstdc++-devel.i686 (Fedora).
37+
38+
Installation with an external FreeType library (the default)
39+
------------------------------------------------------------
40+
41+
Install just the pure Python library and let it find a system-wide installed
42+
FreeType at runtime.
1343

1444
Mac users
15-
---------
45+
~~~~~~~~~
1646

1747
Freetype should be already installed on your system. If not, either install it
1848
using `homebrew <http://brew.sh>`_ or compile it and place the library binary
1949
file in '/usr/local/lib'.
2050

2151
Linux users
22-
-----------
52+
~~~~~~~~~~~
2353

2454
Freetype should be already installed on your system. If not, either install
2555
relevant package from your package manager or compile from sources and place
2656
the library binary file in '/usr/local/lib'.
2757

2858
Window users
29-
------------
59+
~~~~~~~~~~~~
3060

3161
There are no official Freetype binary releases available, but they offer some
3262
links to precompiled Windows DLLs. Please see the `FreeType Downloads
3363
<https://www.freetype.org/download.html>`_ page for links.
34-
You can also compile the FreeType library from source.
64+
You can also compile the FreeType library from source yourself.
3565

36-
32-Bit vs 64-Bit on Windows
37-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
38-
39-
If you are using freetype-py on Windows with a 32-Bit version of python, you
66+
If you are using freetype-py on Windows with a 32-Bit version of Python, you
4067
need the 32-Bit version of the Freetype binary. The same applies for a 64-Bit
41-
version of python.
42-
43-
Installation on Windows
44-
~~~~~~~~~~~~~~~~~~~~~~~
68+
version of Python.
4569

4670
Because of the way Windows searches for dll files, make sure the resulting
4771
file is named 'freetype.dll' (and not something like Freetype245.dll).
@@ -123,3 +147,4 @@ Contributors
123147
* Tao Gong (bug report)
124148
* Matthew Sitton (Remove raw interfaces from the __init__.py file)
125149
* Daniel McCloy (Adde glyph_name function)
150+
* Nikolaus Waxweiler (Setup of CI services and bundling of FreeType)

appveyor.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
environment:
2+
global:
3+
PACKAGE_NAME: freetype-py
4+
FREETYPEPY_BUNDLE_FT: 1
5+
# PyPI username and encrypted password
6+
TWINE_USERNAME: xxx
7+
TWINE_PASSWORD:
8+
secure: xxx
9+
matrix:
10+
- PYTHON: C:\Python27
11+
PYTHON_VERSION: 2.7
12+
PYTHON_ARCH: '32'
13+
14+
- PYTHON: C:\Python36-x64
15+
PYTHON_VERSION: 3.6
16+
PYTHON_ARCH: '64'
17+
18+
init:
19+
- ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%
20+
21+
install:
22+
# If there is a newer build queued for the same PR, cancel this one.
23+
# The AppVeyor 'rollout builds' option is supposed to serve the same
24+
# purpose but it is problematic because it tends to cancel builds pushed
25+
# directly to master instead of just PR builds (or the converse).
26+
# credits: JuliaLang developers.
27+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
28+
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
29+
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
30+
throw "There are newer queued builds for this pull request, failing early." }
31+
32+
# checkout git sub-modules
33+
- git submodule update --init --recursive
34+
35+
# prepend Python to the PATH
36+
- SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%
37+
38+
# check that we have the expected version and architecture for Python
39+
- python --version
40+
- python -c "import struct; print(struct.calcsize('P') * 8)"
41+
42+
# install/upgrade python setup requirements
43+
- python -m pip install --disable-pip-version-check --upgrade pip
44+
- pip --version
45+
- pip install --upgrade setuptools wheel virtualenv
46+
47+
build_script:
48+
# build the wheel in the default 'dist/' folder
49+
- python setup.py bdist_wheel
50+
51+
test_script:
52+
# create test env
53+
- python -m virtualenv test_env
54+
- test_env\Scripts\activate
55+
- where python
56+
- pip install pytest
57+
58+
# install from wheel
59+
- pip install --no-index --find-links dist %PACKAGE_NAME%
60+
61+
# run tests from installed wheel
62+
- cd tests
63+
- pytest
64+
65+
artifacts:
66+
# archive the generated packages in the ci.appveyor.com build report
67+
- path: dist\*.whl
68+
69+
on_success:
70+
# deploy wheels on tags to PyPI
71+
- ps: >-
72+
if($env:APPVEYOR_REPO_TAG -eq 'true') {
73+
Write-Output ("Deploying " + $env:APPVEYOR_REPO_TAG_NAME + " to PyPI...")
74+
pip install --upgrade twine
75+
# If powershell ever sees anything on stderr it thinks it's a fail.
76+
# So we use cmd to redirect stderr to stdout before PS can see it.
77+
cmd /c 'twine upload dist\*.whl 2>&1'
78+
} else {
79+
Write-Output "Not deploying as this is not a tagged commit"
80+
}

ci/multibuild

Submodule multibuild added at cba6a42

ci/multibuild_config.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Define custom utilities
2+
# Test for OSX with [ -n "$IS_OSX" ]
3+
4+
# function pre_build {
5+
# # Any stuff that you need to do before you start building the wheels
6+
# # Runs in the root directory of this repository.
7+
#
8+
# }
9+
10+
function run_tests {
11+
# The function is called from an empty temporary directory.
12+
cd ../tests
13+
python -c "import freetype; print('Using FreeType version ', freetype.version())"
14+
pytest
15+
}

doc/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ Freetype python documentation
44

55
Freetype python provides bindings for the FreeType library. Only the high-level API is bound.
66

7-
Freetype-py lives at https://github.com/rougier/freetype-py/
7+
Freetype-py lives at https://github.com/rougier/freetype-py/, see the installation instructions there.
88

99

1010
.. toctree::
1111
:maxdepth: 1
1212

13-
introduction.rst
1413
usage.rst
1514
screenshots.rst
1615
api.rst

doc/introduction.rst

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)