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

Unbreak CI wheel building on Linux #90

Merged
merged 8 commits into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,32 @@ matrix:
# Exclude the default Python 3.5 build
- python: 3.5
include:
- os: linux
- os: linux # Bundle 32 bit library. Python 2.7 just to test it works there.
env:
- MB_PYTHON_VERSION=2.7
- PLAT=i686
- USE_CCACHE=1
- FREETYPEPY_BUNDLE_FT=1
- os: linux
- os: linux # Bundle 64 bit library.
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
- USE_CCACHE=1
- FREETYPEPY_BUNDLE_FT=1

before_install:
- source ci/multibuild/common_utils.sh
- source ci/multibuild/travis_steps.sh
# Pass FREETYPEPY_BUNDLE_FT environment variable to container.
- source ci/custom_docker.sh
- before_install

install:
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ test_script:

# run tests from installed wheel
- cd tests
- python -c "import freetype; print('Using FreeType version ', freetype.version())"
- pytest

artifacts:
Expand Down
58 changes: 58 additions & 0 deletions ci/custom_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copy of upstream function with added FREETYPEPY_BUNDLE_FT environment var
# passing.

function build_multilinux {
# Runs passed build commands in manylinux container
#
# Depends on
# MB_PYTHON_VERSION
# UNICODE_WIDTH (optional)
# BUILD_DEPENDS (optional)
# DOCKER_IMAGE (optional)
# MANYLINUX_URL (optional)
# WHEEL_SDIR (optional)
local plat=$1
[ -z "$plat" ] && echo "plat not defined" && exit 1
local build_cmds="$2"
local docker_image=${DOCKER_IMAGE:-quay.io/pypa/manylinux1_\$plat}
docker_image=$(eval echo "$docker_image")
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this line do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Dunno 😁

retry docker pull $docker_image

if [ -n "$FREETYPEPY_BUNDLE_FT" ];
then
docker run --rm \
-e FREETYPEPY_BUNDLE_FT="1" \
-e BUILD_COMMANDS="$build_cmds" \
-e PYTHON_VERSION="$MB_PYTHON_VERSION" \
-e UNICODE_WIDTH="$UNICODE_WIDTH" \
-e BUILD_COMMIT="$BUILD_COMMIT" \
-e CONFIG_PATH="$CONFIG_PATH" \
-e ENV_VARS_PATH="$ENV_VARS_PATH" \
-e WHEEL_SDIR="$WHEEL_SDIR" \
-e MANYLINUX_URL="$MANYLINUX_URL" \
-e BUILD_DEPENDS="$BUILD_DEPENDS" \
-e USE_CCACHE="$USE_CCACHE" \
-e REPO_DIR="$repo_dir" \
-e PLAT="$PLAT" \
-v $PWD:/io \
-v $HOME:/parent-home \
$docker_image /io/$MULTIBUILD_DIR/docker_build_wrap.sh
else
docker run --rm \
-e BUILD_COMMANDS="$build_cmds" \
-e PYTHON_VERSION="$MB_PYTHON_VERSION" \
-e UNICODE_WIDTH="$UNICODE_WIDTH" \
-e BUILD_COMMIT="$BUILD_COMMIT" \
-e CONFIG_PATH="$CONFIG_PATH" \
-e ENV_VARS_PATH="$ENV_VARS_PATH" \
-e WHEEL_SDIR="$WHEEL_SDIR" \
-e MANYLINUX_URL="$MANYLINUX_URL" \
-e BUILD_DEPENDS="$BUILD_DEPENDS" \
-e USE_CCACHE="$USE_CCACHE" \
-e REPO_DIR="$repo_dir" \
-e PLAT="$PLAT" \
-v $PWD:/io \
-v $HOME:/parent-home \
$docker_image /io/$MULTIBUILD_DIR/docker_build_wrap.sh
fi
}
12 changes: 7 additions & 5 deletions ci/multibuild_config.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# 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 pre_build {
# Any stuff that you need to do before you start building the wheels
# Runs in the root directory of this repository.
if [ -z "$IS_OSX" ]; then
pip install cmake # Version in manylinux1 container too old.
fi
}

function run_tests {
# The function is called from an empty temporary directory.
Expand Down
11 changes: 8 additions & 3 deletions setup-build-freetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
bitness = 96

if "linux" in sys.platform:
if os.environ.get("PYTHON_ARCH", "") == "32":
if (os.environ.get("PYTHON_ARCH", "") == "32"
or os.environ.get("PLAT", "") == "i686"):
print("# Making a 32 bit build.")
# On a 64 bit Debian/Ubuntu, this needs gcc-multilib and g++-multilib.
# On a 64 bit Fedora, install glibc-devel and libstdc++-devel.
Expand Down Expand Up @@ -179,15 +180,19 @@ def ensure_downloaded(url, sha256_sum):
cwd=build_dir_ft)
shell("cmake --build . --config Release --target install", cwd=build_dir_ft)

# Move libraries from PREFIX/bin to PREFIX/lib if need be (Windows DLLs are
# Move libraries from PREFIX/bin to PREFIX/lib if need be (Windows DLLs are
# treated as runtimes and may end up in bin/). This keeps setup.py simple.
target_dir = path.join(prefix_dir, "lib")
bin_so = glob.glob(path.join(prefix_dir, "bin", "*freetype*"))
bin_so.extend(glob.glob(path.join(prefix_dir, "lib64", "*freetype*")))
bin_so.extend(glob.glob(path.join(prefix_dir, "lib", "freetype*.dll")))
for so in bin_so:
so_target_name = path.basename(so)
if not so_target_name.startswith("lib"):
so_target_name = "lib" + so_target_name
lib_path = path.join(prefix_dir, "lib", so_target_name)
lib_path = path.join(target_dir, so_target_name)

print("# Moving '{}' to '{}'".format(so, lib_path))
if not path.exists(target_dir):
os.makedirs(target_dir)
os.rename(so, lib_path)
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1