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 da7a508
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions maturin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def get_config() -> Dict[str, str]:
return pyproject_toml.get("tool", {}).get("maturin", {})


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


# noinspection PyUnusedLocal
def _build_wheel(
wheel_directory, config_settings=None, metadata_directory=None, editable=False
Expand All @@ -34,6 +39,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 +139,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 da7a508

Please sign in to comment.