pip is a pythonextension not a pythonpackage, and it turns out we werent doing our external surgery on things that inherited pythonextension (#38186)
This commit is contained in:
		| @@ -180,51 +180,6 @@ def test(self): | |||||||
|                 work_dir="spack-test", |                 work_dir="spack-test", | ||||||
|             ) |             ) | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| class PythonPackage(PythonExtension): |  | ||||||
|     """Specialized class for packages that are built using pip.""" |  | ||||||
| 
 |  | ||||||
|     #: Package name, version, and extension on PyPI |  | ||||||
|     pypi: Optional[str] = None |  | ||||||
| 
 |  | ||||||
|     # To be used in UI queries that require to know which |  | ||||||
|     # build-system class we are using |  | ||||||
|     build_system_class = "PythonPackage" |  | ||||||
|     #: Legacy buildsystem attribute used to deserialize and install old specs |  | ||||||
|     legacy_buildsystem = "python_pip" |  | ||||||
| 
 |  | ||||||
|     #: Callback names for install-time test |  | ||||||
|     install_time_test_callbacks = ["test"] |  | ||||||
| 
 |  | ||||||
|     build_system("python_pip") |  | ||||||
| 
 |  | ||||||
|     with spack.multimethod.when("build_system=python_pip"): |  | ||||||
|         extends("python") |  | ||||||
|         depends_on("py-pip", type="build") |  | ||||||
|         # FIXME: technically wheel is only needed when building from source, not when |  | ||||||
|         # installing a downloaded wheel, but I don't want to add wheel as a dep to every |  | ||||||
|         # package manually |  | ||||||
|         depends_on("py-wheel", type="build") |  | ||||||
| 
 |  | ||||||
|     py_namespace: Optional[str] = None |  | ||||||
| 
 |  | ||||||
|     @lang.classproperty |  | ||||||
|     def homepage(cls): |  | ||||||
|         if cls.pypi: |  | ||||||
|             name = cls.pypi.split("/")[0] |  | ||||||
|             return "https://pypi.org/project/" + name + "/" |  | ||||||
| 
 |  | ||||||
|     @lang.classproperty |  | ||||||
|     def url(cls): |  | ||||||
|         if cls.pypi: |  | ||||||
|             return "https://files.pythonhosted.org/packages/source/" + cls.pypi[0] + "/" + cls.pypi |  | ||||||
| 
 |  | ||||||
|     @lang.classproperty |  | ||||||
|     def list_url(cls): |  | ||||||
|         if cls.pypi: |  | ||||||
|             name = cls.pypi.split("/")[0] |  | ||||||
|             return "https://pypi.org/simple/" + name + "/" |  | ||||||
| 
 |  | ||||||
|     def update_external_dependencies(self, extendee_spec=None): |     def update_external_dependencies(self, extendee_spec=None): | ||||||
|         """ |         """ | ||||||
|         Ensure all external python packages have a python dependency |         Ensure all external python packages have a python dependency | ||||||
| @@ -270,6 +225,51 @@ def update_external_dependencies(self, extendee_spec=None): | |||||||
|                     python._mark_concrete() |                     python._mark_concrete() | ||||||
|             self.spec.add_dependency_edge(python, deptypes=("build", "link", "run")) |             self.spec.add_dependency_edge(python, deptypes=("build", "link", "run")) | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | class PythonPackage(PythonExtension): | ||||||
|  |     """Specialized class for packages that are built using pip.""" | ||||||
|  | 
 | ||||||
|  |     #: Package name, version, and extension on PyPI | ||||||
|  |     pypi: Optional[str] = None | ||||||
|  | 
 | ||||||
|  |     # To be used in UI queries that require to know which | ||||||
|  |     # build-system class we are using | ||||||
|  |     build_system_class = "PythonPackage" | ||||||
|  |     #: Legacy buildsystem attribute used to deserialize and install old specs | ||||||
|  |     legacy_buildsystem = "python_pip" | ||||||
|  | 
 | ||||||
|  |     #: Callback names for install-time test | ||||||
|  |     install_time_test_callbacks = ["test"] | ||||||
|  | 
 | ||||||
|  |     build_system("python_pip") | ||||||
|  | 
 | ||||||
|  |     with spack.multimethod.when("build_system=python_pip"): | ||||||
|  |         extends("python") | ||||||
|  |         depends_on("py-pip", type="build") | ||||||
|  |         # FIXME: technically wheel is only needed when building from source, not when | ||||||
|  |         # installing a downloaded wheel, but I don't want to add wheel as a dep to every | ||||||
|  |         # package manually | ||||||
|  |         depends_on("py-wheel", type="build") | ||||||
|  | 
 | ||||||
|  |     py_namespace: Optional[str] = None | ||||||
|  | 
 | ||||||
|  |     @lang.classproperty | ||||||
|  |     def homepage(cls): | ||||||
|  |         if cls.pypi: | ||||||
|  |             name = cls.pypi.split("/")[0] | ||||||
|  |             return "https://pypi.org/project/" + name + "/" | ||||||
|  | 
 | ||||||
|  |     @lang.classproperty | ||||||
|  |     def url(cls): | ||||||
|  |         if cls.pypi: | ||||||
|  |             return "https://files.pythonhosted.org/packages/source/" + cls.pypi[0] + "/" + cls.pypi | ||||||
|  | 
 | ||||||
|  |     @lang.classproperty | ||||||
|  |     def list_url(cls): | ||||||
|  |         if cls.pypi: | ||||||
|  |             name = cls.pypi.split("/")[0] | ||||||
|  |             return "https://pypi.org/simple/" + name + "/" | ||||||
|  | 
 | ||||||
|     def get_external_python_for_prefix(self): |     def get_external_python_for_prefix(self): | ||||||
|         """ |         """ | ||||||
|         For an external package that extends python, find the most likely spec for the python |         For an external package that extends python, find the most likely spec for the python | ||||||
|   | |||||||
| @@ -1231,6 +1231,7 @@ def dependencies_of_type(cls, *deptypes): | |||||||
|             if any(dt in cls.dependencies[name][cond].type for cond in conds for dt in deptypes) |             if any(dt in cls.dependencies[name][cond].type for cond in conds for dt in deptypes) | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|  |     # TODO: allow more than one active extendee. | ||||||
|     @property |     @property | ||||||
|     def extendee_spec(self): |     def extendee_spec(self): | ||||||
|         """ |         """ | ||||||
| @@ -1246,7 +1247,6 @@ def extendee_spec(self): | |||||||
|             if dep.name in self.extendees: |             if dep.name in self.extendees: | ||||||
|                 deps.append(dep) |                 deps.append(dep) | ||||||
| 
 | 
 | ||||||
|         # TODO: allow more than one active extendee. |  | ||||||
|         if deps: |         if deps: | ||||||
|             assert len(deps) == 1 |             assert len(deps) == 1 | ||||||
|             return deps[0] |             return deps[0] | ||||||
| @@ -1256,7 +1256,6 @@ def extendee_spec(self): | |||||||
|         if self.spec._concrete: |         if self.spec._concrete: | ||||||
|             return None |             return None | ||||||
|         else: |         else: | ||||||
|             # TODO: do something sane here with more than one extendee |  | ||||||
|             # If it's not concrete, then return the spec from the |             # If it's not concrete, then return the spec from the | ||||||
|             # extends() directive since that is all we know so far. |             # extends() directive since that is all we know so far. | ||||||
|             spec_str, kwargs = next(iter(self.extendees.items())) |             spec_str, kwargs = next(iter(self.extendees.items())) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Peter Scheibel
					Peter Scheibel