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 with --no-default-features by default when bootstrapping from sdist #1333

Merged
merged 1 commit into from
Dec 5, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* **Breaking Change**: Build with `--no-default-features` by default when bootstrapping from sdist in [#1333](https://github.com/PyO3/maturin/pull/1333)

## [0.14.4] - 2022-12-05

* Expanded architecture support for FreeBSD, NetBSD and OpenBSD in [#1318](https://github.com/PyO3/maturin/pull/1318)
Expand Down
31 changes: 10 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# maturin is self bootstraping, however on platforms like alpine linux that aren't
# manylinux, pip will try installing maturin from the source distribution.
# maturin is self bootstrapping, however on platforms like FreeBSD that aren't
# manylinux/musllinux, pip will try installing maturin from the source distribution.
# That source distribution obviously can't depend on maturin, so we're using
# the always available setuptools.
#
# Note that this is really only a workaround for bootstrapping and not suited
# for general purpose packaging, i.e. only building a wheel (as in
# `python setup.py bdist_wheel`) and installing (as in
# `pip install <source dir>` are supported. For creating a source distribution
# `pip install <source dir>`) are supported. For creating a source distribution
# for maturin itself use `maturin sdist`.

import platform
import sys
import os

try:
import tomllib
Expand All @@ -24,7 +23,7 @@
# https://stackoverflow.com/a/45150383/3549270
# There's also the much more concise solution in
# https://stackoverflow.com/a/53463910/3549270,
# but that would requires python-dev
# but that would require python-dev
try:
# noinspection PyPackageRequirements,PyUnresolvedReferences
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
Expand All @@ -44,21 +43,11 @@ def finalize_options(self):
with open("Cargo.toml", "rb") as fp:
version = tomllib.load(fp)["package"]["version"]

cargo_args = []
if platform.machine() in (
"mips",
"mips64",
"ppc",
"ppc64le",
"ppc64",
"powerpc",
"riscv64",
"sparc64",
) or (sys.platform == "win32" and platform.machine() == "ARM64"):
cargo_args.extend(["--no-default-features", "--features=upload,log"])
elif sys.platform.startswith("haiku"):
# mio and ring doesn't build on haiku
cargo_args.extend(["--no-default-features", "--features=log"])
# Use `--no-default-features` by default for a minimal build to support PEP 517.
# `MATURIN_SETUP_ARGS` env var can be used to pass customized arguments to cargo.
cargo_args = ["--no-default-features"]
if os.getenv("MATURIN_SETUP_ARGS"):
cargo_args = os.getenv("MATURIN_SETUP_ARGS").split()

setup(
name="maturin",
Expand Down