Skip to content

Commit

Permalink
Merge 78e7251 into 985f054
Browse files Browse the repository at this point in the history
  • Loading branch information
madig committed Apr 10, 2018
2 parents 985f054 + 78e7251 commit 239e794
Show file tree
Hide file tree
Showing 15 changed files with 585 additions and 120 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ci/multibuild"]
path = ci/multibuild
url = https://github.com/matthew-brett/multibuild
81 changes: 81 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
env:
global:
- REPO_DIR=.
# Commit from your-project that you want to build
#- BUILD_COMMIT=v0.1.0
# pip dependencies to _build_ your project
#- BUILD_DEPENDS="Cython numpy"
# pip dependencies to _test_ your project. Include any dependencies
# that you need, that are also specified in BUILD_DEPENDS, this will be
# a separate install.
- TEST_DEPENDS="pytest"
- PLAT=x86_64
- CONFIG_PATH="ci/multibuild_config.sh"

language: python
# The travis Python version is unrelated to the version we build and test
# with. This is set with the MB_PYTHON_VERSION variable.
python: 3.5
sudo: required
dist: trusty
services: docker

cache:
directories:
- $HOME/.ccache

matrix:
exclude:
# Exclude the default Python 3.5 build
- python: 3.5
include:
- os: linux
env:
- MB_PYTHON_VERSION=2.7
- PLAT=i686
- USE_CCACHE=1
- FREETYPEPY_BUNDLE_FT=1
- os: linux
env:
- MB_PYTHON_VERSION=3.6
- USE_CCACHE=1
- FREETYPEPY_BUNDLE_FT=1
- os: linux # No bundling.
env:
- MB_PYTHON_VERSION=3.6
- USE_CCACHE=1
- os: osx
language: generic
env:
- MB_PYTHON_VERSION=3.6
- FREETYPEPY_BUNDLE_FT=1

before_install:
- source ci/multibuild/common_utils.sh
- source ci/multibuild/travis_steps.sh
- before_install

install:
- build_wheel $REPO_DIR $PLAT

script:
- install_run $PLAT

after_success:
# copy compiled wheels to dist/ where Travis `dpl` tool can find them and
# upload to PyPI
- if [ -n "$TRAVIS_TAG" ]; then mkdir -p dist; cp wheelhouse/*.whl dist; fi

deploy:
# Deploy to PyPI on tags. Since the hard work of building wheels is already
# done, we need to defeat some of Travis' automation.
provider: pypi
on:
repo: rougier/freetype-py # Prevent triggering from forks.
tags: true
all_branches: true
user: xxx
password:
secure: xxx
skip_cleanup: true # Prevent deletion of dist/*.
distributions: check # Dummy argument so dists aren't rebuilt by dpl.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ recursive-include examples *
include MANIFEST.in
include LICENSE.txt
include README.rst
include setup-build-freetype.py
59 changes: 42 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,47 +1,71 @@
FreeType high-level python API
==============================
FreeType (high-level Python API)
================================

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

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

Installation
============

To be able to use freetype python, you need the freetype library version 2
installed on your system.
**From PyPI, recommended**: `pip install freetype-py`. This will install the
library with a bundled FreeType binary, so you're ready to go on Windows,
macOS and Linux (all with 32 and 64 bit x86 architecture support).

Do note: if you specify the `--no-binary` paramater to pip, or use a different
architecture for which we don't pre-compile binaries, the package will default
to using an external FreeType library. Specify the environment variable
`FREETYPEPY_BUNDLE_FT=1` before calling pip to compile a binary yourself.

Installation with compiling FreeType from source
------------------------------------------------

If you don't want to or can't use the pre-built binaries, build FreeType
yourself: `export FREETYPEPY_BUNDLE_FT=yesplease && pip install .`.
This will download and compile FreeType with Harfbuzz support as specified in
`setup-build-freetype.py`. Set the environment variable `PYTHON_ARCH` to 32 or
64 to explicitly set an architecture, default is whatever your host machine
uses. On macOS, we will always build a universal 32 and 64 bit Intel binary.

- Windows: You need CMake and a C and C++ compiler, e.g. the Visual Code
Community 2017 distribution with the desktop C++ workload.
- macOS: You need CMake and the XCode tools (full IDE not necessary)
- Linux: You need CMake, gcc and g++. For building a 32 bit library on a
64 bit machine, you need gcc-multilib and g++-multilib (Debian) or
glibc-devel.i686 and libstdc++-devel.i686 (Fedora).

Installation with an external FreeType library (the default)
------------------------------------------------------------

Install just the pure Python library and let it find a system-wide installed
FreeType at runtime.

Mac users
---------
~~~~~~~~~

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

Linux users
-----------
~~~~~~~~~~~

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

Window users
------------
~~~~~~~~~~~~

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

32-Bit vs 64-Bit on Windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you are using freetype-py on Windows with a 32-Bit version of python, you
If you are using freetype-py on Windows with a 32-Bit version of Python, you
need the 32-Bit version of the Freetype binary. The same applies for a 64-Bit
version of python.

Installation on Windows
~~~~~~~~~~~~~~~~~~~~~~~
version of Python.

Because of the way Windows searches for dll files, make sure the resulting
file is named 'freetype.dll' (and not something like Freetype245.dll).
Expand Down Expand Up @@ -123,3 +147,4 @@ Contributors
* Tao Gong (bug report)
* Matthew Sitton (Remove raw interfaces from the __init__.py file)
* Daniel McCloy (Adde glyph_name function)
* Nikolaus Waxweiler (Setup of CI services and bundling of FreeType)
80 changes: 80 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
environment:
global:
PACKAGE_NAME: freetype-py
FREETYPEPY_BUNDLE_FT: 1
# PyPI username and encrypted password
TWINE_USERNAME: xxx
TWINE_PASSWORD:
secure: xxx
matrix:
- PYTHON: C:\Python27
PYTHON_VERSION: 2.7
PYTHON_ARCH: '32'

- PYTHON: C:\Python36-x64
PYTHON_VERSION: 3.6
PYTHON_ARCH: '64'

init:
- ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%

install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }

# checkout git sub-modules
- git submodule update --init --recursive

# prepend Python to the PATH
- SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%

# check that we have the expected version and architecture for Python
- python --version
- python -c "import struct; print(struct.calcsize('P') * 8)"

# install/upgrade python setup requirements
- python -m pip install --disable-pip-version-check --upgrade pip
- pip --version
- pip install --upgrade setuptools wheel virtualenv

build_script:
# build the wheel in the default 'dist/' folder
- python setup.py bdist_wheel

test_script:
# create test env
- python -m virtualenv test_env
- test_env\Scripts\activate
- where python
- pip install pytest

# install from wheel
- pip install --no-index --find-links dist %PACKAGE_NAME%

# run tests from installed wheel
- cd tests
- pytest

artifacts:
# archive the generated packages in the ci.appveyor.com build report
- path: dist\*.whl

on_success:
# deploy wheels on tags to PyPI
- ps: >-
if($env:APPVEYOR_REPO_TAG -eq 'true') {
Write-Output ("Deploying " + $env:APPVEYOR_REPO_TAG_NAME + " to PyPI...")
pip install --upgrade twine
# If powershell ever sees anything on stderr it thinks it's a fail.
# So we use cmd to redirect stderr to stdout before PS can see it.
cmd /c 'twine upload dist\*.whl 2>&1'
} else {
Write-Output "Not deploying as this is not a tagged commit"
}
1 change: 1 addition & 0 deletions ci/multibuild
Submodule multibuild added at cba6a4
15 changes: 15 additions & 0 deletions ci/multibuild_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Define custom utilities
# Test for OSX with [ -n "$IS_OSX" ]

# function pre_build {
# # Any stuff that you need to do before you start building the wheels
# # Runs in the root directory of this repository.
#
# }

function run_tests {
# The function is called from an empty temporary directory.
cd ../tests
python -c "import freetype; print('Using FreeType version ', freetype.version())"
pytest
}
3 changes: 1 addition & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ Freetype python documentation

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

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


.. toctree::
:maxdepth: 1

introduction.rst
usage.rst
screenshots.rst
api.rst
Expand Down
53 changes: 0 additions & 53 deletions doc/introduction.rst

This file was deleted.

0 comments on commit 239e794

Please sign in to comment.