Let conan config install walk the fs tree looking for a .conanignore#18170
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to have "conan config install" search up the file system for a .conanignore file, preventing unwanted files from being installed.
- Introduces tests to verify behavior when a .conanignore is present or absent.
- Implements a new helper function that walks the directory tree to locate a .conanignore file.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/integration/command/config_test.py | Added tests to validate that the .conanignore is correctly applied. |
| conan/internal/api/config/config_installer.py | Added the recursive lookup helper (_find_conaningore) and updated folder processing to use it. |
Comments suppressed due to low confidence (2)
test/integration/command/config_test.py:168
- [nitpick] The test function name 'test_config_install_conanignore_march_directories' appears to contain a typo. Consider renaming it to something like 'test_config_install_conanignore_match_directories' for clarity.
def test_config_install_conanignore_march_directories(has_conanignore, folder):
conan/internal/api/config/config_installer.py:131
- The function name '_find_conaningore' seems to be misspelled; consider renaming it to '_find_conanignore' to accurately reflect its purpose and align with established naming conventions.
def _find_conaningore(folder):
0ae8eb3 to
e0e1495
Compare
|
@AbrilRBS Besides the comment, there are conflicts pending 🙏 |
eab8cc9 to
399d27a
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the “conan config install” command by updating the file search logic so that a .conanignore file can be located by walking up the file system tree. Key changes include:
- Adding a new helper function (find_file_walk_up) to traverse parent directories.
- Refactoring tests in both unit and integration suites to verify the new upward search behavior.
- Updating the config installer to use the new helper function in determining the .conanignore file.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/unittests/paths/user_home_test.py | Refactored tests into classes and added tests for the new helper function. |
| test/integration/command/config_test.py | Added parametrized tests to validate the .conanignore behavior during config install. |
| conan/internal/paths.py | Introduced find_file_walk_up and updated get_conan_user_home to use it. |
| conan/internal/api/config/config_installer.py | Updated _process_folder to use find_file_walk_up for locating the .conanignore file. |
… the source_path path
…into ar/conanignore-walk-tree
| with chdir(folder_conan_runs): | ||
| conan_home = get_conan_user_home() | ||
| assert _temp_folder == conan_home | ||
| class TestConanUserHome: |
There was a problem hiding this comment.
Same tests here, just moved to a class
Changelog: Bugfix: Let
conan config installwalk the fs tree looking for a.conanignore.Docs: Omit
I was trying to install a specific command from conan-extensions and realized that the readme next to it was being installed too.
This PR is a draft because I'm not quite sure of the implications of walking the tree in all contexts where this could be called: