Skip to content

Commit

Permalink
Remove [tool.maturin] options from Python PEP 517 side
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Aug 13, 2021
1 parent c8cb029 commit 4d21a0a
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions maturin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,22 @@
import subprocess
import sys
from subprocess import SubprocessError
from typing import List, Dict
from typing import Dict

import toml

# these are only used when creating the sdist, not when building it
create_only_options = [
"sdist-include",
]

available_options = [
"bindings",
"cargo-extra-args",
"compatibility",
"manylinux",
"rustc-extra-args",
"skip-auditwheel",
"strip",
]


def get_config() -> Dict[str, str]:
with open("pyproject.toml", encoding="utf-8") as fp:
pyproject_toml = toml.load(fp)
return pyproject_toml.get("tool", {}).get("maturin", {})


def get_config_options() -> List[str]:
config = get_config()
options = []
for key, value in config.items():
if key in create_only_options:
continue
if key not in available_options:
# attempt to install even if keys from newer or older versions are present
sys.stderr.write(f"WARNING: {key} is not a recognized option for maturin\n")
options.append("--{}={}".format(key, value))
return options


# noinspection PyUnusedLocal
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
# PEP 517 specifies that only `sys.executable` points to the correct
# python interpreter
command = ["maturin", "pep517", "build-wheel", "-i", sys.executable]
command.extend(get_config_options())

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

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

0 comments on commit 4d21a0a

Please sign in to comment.