From 2b5a7bb4d7428529d7603d1b711beab0baa76b1c Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 17 Jul 2023 08:03:05 -0500 Subject: Update new PythonPackage template to prefer --config-settings (#38918) --- lib/spack/spack/build_systems/python.py | 7 ++++++- lib/spack/spack/cmd/create.py | 15 +++++---------- lib/spack/spack/test/cmd/create.py | 7 +------ 3 files changed, 12 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index 7a355490f7..01f7bd62be 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -401,7 +401,8 @@ class PythonPipBuilder(BaseBuilder): def config_settings(self, spec, prefix): """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: spec (spack.spec.Spec): build spec @@ -415,6 +416,8 @@ class PythonPipBuilder(BaseBuilder): def install_options(self, spec, prefix): """Extra arguments to be supplied to the setup.py install command. + Requires pip 23.0 or older. + Args: spec (spack.spec.Spec): build spec prefix (spack.util.prefix.Prefix): installation prefix @@ -428,6 +431,8 @@ class PythonPipBuilder(BaseBuilder): """Extra global options to be supplied to the setup.py call before the install or bdist_wheel command. + Deprecated in pip 23.1. + Args: spec (spack.spec.Spec): build spec prefix (spack.util.prefix.Prefix): installation prefix diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index 41562c98ec..ab84da4151 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -325,6 +325,7 @@ class PythonPackageTemplate(PackageTemplate): # FIXME: Add a build backend, usually defined in pyproject.toml. If no such file # exists, use setuptools. # depends_on("py-setuptools", type="build") + # depends_on("py-hatchling", type="build") # depends_on("py-flit-core", type="build") # depends_on("py-poetry-core", type="build") @@ -332,17 +333,11 @@ class PythonPackageTemplate(PackageTemplate): # depends_on("py-foo", type=("build", "run"))""" body_def = """\ - def global_options(self, spec, prefix): - # FIXME: Add options to pass to setup.py + def config_settings(self, spec, prefix): + # FIXME: Add configuration settings to be passed to the build backend # FIXME: If not needed, delete this function - options = [] - return options - - 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""" + settings = {} + return settings""" def __init__(self, name, url, *args, **kwargs): # If the user provided `--name py-numpy`, don't rename it py-py-numpy diff --git a/lib/spack/spack/test/cmd/create.py b/lib/spack/spack/test/cmd/create.py index ed7a6404bb..b99d221d02 100644 --- a/lib/spack/spack/test/cmd/create.py +++ b/lib/spack/spack/test/cmd/create.py @@ -91,12 +91,7 @@ create = SpackCommand("create") ( ["-t", "python", "/test-python"], "py-test-python", - [ - r"PyTestPython(PythonPackage)", - r'depends_on("py-', - r"def global_options(self", - r"def install_options(self", - ], + [r"PyTestPython(PythonPackage)", r'depends_on("py-', r"def config_settings(self"], ), ( ["-t", "qmake", "/test-qmake"], -- cgit v1.2.3-60-g2f50