scikit-build-core icon indicating copy to clipboard operation
scikit-build-core copied to clipboard

fix: Ignore pre-installed self-package from prefix_path

Open LecrisUT opened this issue 1 year ago • 1 comments

Context:

  • This came up when working on https://github.com/spglib/spglib/pull/520
  • Upstream CMake issue https://gitlab.kitware.com/cmake/cmake/-/issues/26213

I am opening to brainstorm some ideas on how to implement.

TODO:

  • [ ] Expose the ignore_prefix_path as a configure variable
  • [ ] Do not use canonical_name as self project name, instead find out the path from installed python files, entry-point etc.
  • [ ] How to deal when the project shared the CMake install path with another project?
  • [ ] Figure out why CMAKE_IGNORE_PREFIX_PATH does not works as intended
  • [ ] Write tests

About CMAKE_IGNORE_PREFIX_PATH not working as intended. From what I've tested, if I put the path as site-packages/spglib, then this does not work, it still continues to find the pre-installed package files, but if I remove the spglib path and make it point to effectively the same folder as CMAKE_PREFIX_PATH, it does work. This seems like a bug in CMake that it doesn't resolve itself when CMAKE_IGNORE_PREFIX_PATH is a child of CMAKE_PREFIX_PATH, which as much as I think about it, it should be this way right?

Here is what I managed to track down from upstream:

  1. Parse CMAKE_IGNORE_PREFIX_PATH
  2. Pass CMAKE_IGNORE_PREFIX_PATH to construct search path list
  3. Logic for filtering search paths

LecrisUT avatar Aug 13 '24 16:08 LecrisUT

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.95%. Comparing base (4f06e8c) to head (a09cf06). Report is 123 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #862      +/-   ##
==========================================
+ Coverage   83.91%   83.95%   +0.04%     
==========================================
  Files          74       74              
  Lines        4363     4375      +12     
==========================================
+ Hits         3661     3673      +12     
  Misses        702      702              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Aug 13 '24 16:08 codecov[bot]