Update new PythonPackage template to prefer --config-settings (#38918)

This commit is contained in:
Adam J. Stewart 2023-07-17 08:03:05 -05:00 committed by GitHub
parent e91db77930
commit 2b5a7bb4d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 17 deletions

View file

@ -401,7 +401,8 @@ def build_directory(self):
def config_settings(self, spec, prefix): def config_settings(self, spec, prefix):
"""Configuration settings to be passed to the PEP 517 build backend. """Configuration settings to be passed to the PEP 517 build backend.
Requires pip 22.1+, which requires Python 3.7+.
Requires pip 22.1 or newer.
Args: Args:
spec (spack.spec.Spec): build spec spec (spack.spec.Spec): build spec
@ -415,6 +416,8 @@ def config_settings(self, spec, prefix):
def install_options(self, spec, prefix): def install_options(self, spec, prefix):
"""Extra arguments to be supplied to the setup.py install command. """Extra arguments to be supplied to the setup.py install command.
Requires pip 23.0 or older.
Args: Args:
spec (spack.spec.Spec): build spec spec (spack.spec.Spec): build spec
prefix (spack.util.prefix.Prefix): installation prefix prefix (spack.util.prefix.Prefix): installation prefix
@ -428,6 +431,8 @@ def global_options(self, spec, prefix):
"""Extra global options to be supplied to the setup.py call before the install """Extra global options to be supplied to the setup.py call before the install
or bdist_wheel command. or bdist_wheel command.
Deprecated in pip 23.1.
Args: Args:
spec (spack.spec.Spec): build spec spec (spack.spec.Spec): build spec
prefix (spack.util.prefix.Prefix): installation prefix prefix (spack.util.prefix.Prefix): installation prefix

View file

@ -325,6 +325,7 @@ class PythonPackageTemplate(PackageTemplate):
# FIXME: Add a build backend, usually defined in pyproject.toml. If no such file # FIXME: Add a build backend, usually defined in pyproject.toml. If no such file
# exists, use setuptools. # exists, use setuptools.
# depends_on("py-setuptools", type="build") # depends_on("py-setuptools", type="build")
# depends_on("py-hatchling", type="build")
# depends_on("py-flit-core", type="build") # depends_on("py-flit-core", type="build")
# depends_on("py-poetry-core", type="build") # depends_on("py-poetry-core", type="build")
@ -332,17 +333,11 @@ class PythonPackageTemplate(PackageTemplate):
# depends_on("py-foo", type=("build", "run"))""" # depends_on("py-foo", type=("build", "run"))"""
body_def = """\ body_def = """\
def global_options(self, spec, prefix): def config_settings(self, spec, prefix):
# FIXME: Add options to pass to setup.py # FIXME: Add configuration settings to be passed to the build backend
# FIXME: If not needed, delete this function # FIXME: If not needed, delete this function
options = [] settings = {}
return options return settings"""
def install_options(self, spec, prefix):
# FIXME: Add options to pass to setup.py install
# FIXME: If not needed, delete this function
options = []
return options"""
def __init__(self, name, url, *args, **kwargs): def __init__(self, name, url, *args, **kwargs):
# If the user provided `--name py-numpy`, don't rename it py-py-numpy # If the user provided `--name py-numpy`, don't rename it py-py-numpy

View file

@ -91,12 +91,7 @@
( (
["-t", "python", "/test-python"], ["-t", "python", "/test-python"],
"py-test-python", "py-test-python",
[ [r"PyTestPython(PythonPackage)", r'depends_on("py-', r"def config_settings(self"],
r"PyTestPython(PythonPackage)",
r'depends_on("py-',
r"def global_options(self",
r"def install_options(self",
],
), ),
( (
["-t", "qmake", "/test-qmake"], ["-t", "qmake", "/test-qmake"],