Skip to content

Commit

Permalink
Pass arguments to pep517 command via MATURIN_PEP517_ARGS env var
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Jan 23, 2022
1 parent 5e1fac6 commit 6d9e26f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Switch from reqwest to ureq to reduce dependencies in [#767](https://github.com/PyO3/maturin/pull/767)
* Fix missing Python submodule in wheel in [#772](https://github.com/PyO3/maturin/pull/772)
* Add support for specifying cargo manifest path in pyproject.toml in [#781](https://github.com/PyO3/maturin/pull/781)
* Add support for passing arguments to pep517 command via `MATURIN_PEP517_ARGS` env var in [#786](https://github.com/PyO3/maturin/pull/786)

## [0.12.6] - 2021-12-31

Expand Down
12 changes: 12 additions & 0 deletions maturin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import os
import shlex
import shutil
import subprocess
import sys
Expand All @@ -25,6 +26,11 @@ def get_config() -> Dict[str, str]:
return pyproject_toml.get("tool", {}).get("maturin", {})


def get_maturin_pep517_args():
args = shlex.split(os.getenv("MATURIN_PEP517_ARGS", ""))
return args


# noinspection PyUnusedLocal
def _build_wheel(
wheel_directory, config_settings=None, metadata_directory=None, editable=False
Expand All @@ -34,6 +40,9 @@ def _build_wheel(
command = ["maturin", "pep517", "build-wheel", "-i", sys.executable]
if editable:
command.append("--editable")
pep517_args = get_maturin_pep517_args()
if pep517_args:
command.extend(pep517_args)

print("Running `{}`".format(" ".join(command)))
sys.stdout.flush()
Expand Down Expand Up @@ -131,6 +140,9 @@ def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
"--interpreter",
sys.executable,
]
pep517_args = get_maturin_pep517_args()
if pep517_args:
command.extend(pep517_args)

print("Running `{}`".format(" ".join(command)))
try:
Expand Down

0 comments on commit 6d9e26f

Please sign in to comment.