Update new PythonPackage template to prefer --config-settings (#38918)
This commit is contained in:
		@@ -401,7 +401,8 @@ def build_directory(self):
 | 
			
		||||
 | 
			
		||||
    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 @@ def config_settings(self, spec, prefix):
 | 
			
		||||
    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 @@ def global_options(self, spec, prefix):
 | 
			
		||||
        """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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -91,12 +91,7 @@
 | 
			
		||||
        (
 | 
			
		||||
            ["-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"],
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user