-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[cmake] Produce python .dist-info metadata #22688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import importlib.metadata as meta | ||
| import unittest | ||
|
|
||
|
|
||
| class PackageMetadata(unittest.TestCase): | ||
| def test_query_metadata(self): | ||
| try: | ||
| meta.version("ROOT") | ||
| except Exception: | ||
| raise AssertionError("importlib failed to access .dist-info metadata for ROOT package") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Installs Python METADATA and INSTALLER files for compatibility with importlib.metadata | ||
| # The presence of INSTALLER (along with intentionally neglecting RECORD) prevents | ||
| # package managers from uninstalling or otherwise touching the ROOT import package if | ||
| # it wasn't installed via a wheel. | ||
| # See: https://packaging.python.org/en/latest/specifications/recording-installed-packages/ | ||
|
|
||
| # scikit-build-core handles metadata so only do this for non-wheel builds to avoid conflict | ||
| if(NOT _wheel_build) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we are missing more checks: |
||
| configure_file("${CMAKE_SOURCE_DIR}/config/METADATA.in" "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/root-${ROOT_VERSION}.dist-info/METADATA" @ONLY NEWLINE_STYLE UNIX) | ||
| file(WRITE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/root-${ROOT_VERSION}.dist-info/INSTALLER" "CMake") | ||
| install(DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/root-${ROOT_VERSION}.dist-info" DESTINATION "${CMAKE_INSTALL_PYTHONDIR}") | ||
| endif() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Metadata-Version: 2.2 | ||
| Name: root | ||
| Version: @ROOT_VERSION@ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add newline at end of file |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
importlibis part of the standard Python libraries, so we don't need to signal the dependency explicitly since it will always be present with a Python installation