-
Notifications
You must be signed in to change notification settings - Fork 428
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
which_package
to yield unique collection of package records
#5108
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
20d0a12
Add which_package unittest
kenodegard 7998d33
Only yield package record once
kenodegard 3f19216
Add news
kenodegard f955083
Skip using tmp_env in older conda
kenodegard 2ce0e20
Refactor test_which_package into a local test
kenodegard 904078a
Prefer str over repr in _lookup_in_prefix_packages
kenodegard 424e1f2
Update news/5108-fix-which_package
kenodegard 89c7bc8
Set comparison
kenodegard 496092c
Fix softlink test per feedback
kenodegard 05785c7
Remove tmp_env fixture
kenodegard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
### Enhancements | ||
|
||
* <news item> | ||
|
||
### Bug fixes | ||
|
||
* Fix `conda_build.inspect_pkg.which_package` so it does not return duplicate package records. (#5108) | ||
kenodegard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Deprecations | ||
|
||
* <news item> | ||
|
||
### Docs | ||
|
||
* <news item> | ||
|
||
### Other | ||
|
||
* <news item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (C) 2014 Anaconda, Inc | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
from __future__ import annotations | ||
|
||
import pytest | ||
from conda import __version__ as conda_version | ||
from conda.core.prefix_data import PrefixData | ||
from packaging.version import Version, parse | ||
|
||
from conda_build.inspect_pkg import which_package | ||
|
||
if TYPE_CHECKING := False: | ||
from conda.testing import TmpEnvFixture | ||
|
||
|
||
@pytest.mark.skipif( | ||
parse(conda_version) < Version("23.5.0"), | ||
reason="tmp_env fixture first available in conda 23.5.0", | ||
) | ||
def test_which_package(tmp_env: TmpEnvFixture): | ||
with tmp_env("ca-certificates") as prefix: | ||
pd = PrefixData(prefix) | ||
prec = pd.get("ca-certificates") | ||
precs = list(which_package(prefix / prec.files[0], prefix)) | ||
kenodegard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assert len(precs) == 1 | ||
assert precs[0] == prec |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
(n * m)
? I see this version skips work if true.Too bad to iterate over all installed files to do the search
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.
worst case yes, same as before
any
returns on the firstTrue
: https://docs.python.org/3/library/functions.html#anyThere 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.
This is what avoids the duplicated records to begin with, right?
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.
In a subsequent PR, we could see if implementing a cached
path -> artifact
map would speed this up. It can be a veeery slow part of the post processing stage in conda-build.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.
correct, this is essentially what was happening pre #5041:
conda-build/conda_build/inspect_pkg.py
Lines 57 to 62 in c71c4ab
definitely something to consider