-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from rougier/pep517-custom-backend
use custom PEP517 build backend to require cmake conditionally
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Custom PEP 517 build backend to provide different dependencies for wheel builds. | ||
We need some extra dependencies when we build a wheel that bundles the FreeType | ||
shared library (triggered when FREETYPEPY_BUNDLE_FT environment variable is set), | ||
as opposed to a pure Python wheel (py3-none-any.whl). | ||
For more info see: | ||
https://setuptools.pypa.io/en/latest/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks | ||
https://github.com/rougier/freetype-py/issues/183 | ||
""" | ||
|
||
import os | ||
from setuptools import build_meta as _orig | ||
from setuptools.build_meta import * | ||
|
||
|
||
def get_requires_for_build_wheel(config_settings=None): | ||
build_wheel_deps = _orig.get_requires_for_build_wheel(config_settings) | ||
|
||
if os.environ.get("FREETYPEPY_BUNDLE_FT"): | ||
build_wheel_deps += ["certifi", "cmake"] | ||
|
||
return build_wheel_deps | ||
|
||
|
||
def get_requires_for_build_editable(config_settings=None): | ||
# ensure pip install -e . uses same build deps as regular pip install/wheel | ||
return get_requires_for_build_wheel(config_settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "certifi", "cmake"] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] | ||
# https://setuptools.pypa.io/en/latest/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks | ||
build-backend = "backend" | ||
backend-path = ["_custom_build"] |