-
Notifications
You must be signed in to change notification settings - Fork 371
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
Fix dependency and subdir
in repoquery whoneeds
#3743
base: main
Are you sure you want to change the base?
Changes from 2 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 | ||||
---|---|---|---|---|---|---|
|
@@ -581,13 +581,6 @@ namespace mamba | |||||
{ | ||||||
return util::split(str, "/", 1).front(); // Has at least one element | ||||||
} | ||||||
|
||||||
/** Get subdir from channel name. */ | ||||||
auto get_subdir(std::string_view str) -> std::string | ||||||
{ | ||||||
return util::split(str, "/").back(); | ||||||
} | ||||||
|
||||||
} | ||||||
|
||||||
auto QueryResult::table(std::ostream& out, const std::vector<std::string_view>& columns) const | ||||||
|
@@ -599,7 +592,7 @@ namespace mamba | |||||
} | ||||||
|
||||||
std::vector<mamba::printers::FormattedString> headers; | ||||||
std::vector<std::string_view> cmds, args; | ||||||
std::vector<std::string> cmds, args; | ||||||
std::vector<mamba::printers::alignment> alignments; | ||||||
for (auto& col : columns) | ||||||
{ | ||||||
|
@@ -621,7 +614,7 @@ namespace mamba | |||||
else if (col.find_first_of(":") == col.npos) | ||||||
{ | ||||||
headers.emplace_back(col); | ||||||
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. Could the current code have problem as well? How about?
Suggested change
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. Converting 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. Sorry, my remark was not clear. I was wondering whether we could also have this problem for all vectors referencing 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. Since |
||||||
cmds.push_back(col); | ||||||
cmds.push_back(std::string(col)); | ||||||
args.emplace_back(""); | ||||||
} | ||||||
else | ||||||
|
@@ -670,7 +663,7 @@ namespace mamba | |||||
} | ||||||
else if (cmd == "Subdir") | ||||||
{ | ||||||
row.emplace_back(get_subdir(pkg.channel)); | ||||||
row.emplace_back(pkg.platform); | ||||||
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. This was not tested and was returning the channel |
||||||
} | ||||||
else if (cmd == "Depends") | ||||||
{ | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,15 +146,9 @@ def test_whoneeds_remote(yaml_env: Path): | |
def test_whoneeds_not_installed_with_channel(yaml_env: Path, with_platform): | ||
if with_platform: | ||
res = helpers.umamba_repoquery( | ||
"whoneeds", | ||
"-c", | ||
"conda-forge", | ||
"xtensor=0.24.5", | ||
"--platform", | ||
"osx-64", | ||
"--json", | ||
"whoneeds", "-c", "conda-forge", "xtensor=0.24.5", "--platform", "osx-64", "--json" | ||
) | ||
assert res["result"]["pkgs"][0]["subdir"] == "osx-64" | ||
assert all("osx-64" in pkg["subdir"] for pkg in res["result"]["pkgs"]) | ||
else: | ||
res = helpers.umamba_repoquery("whoneeds", "-c", "conda-forge", "xtensor=0.24.5", "--json") | ||
|
||
|
@@ -168,6 +162,20 @@ def test_whoneeds_not_installed_with_channel(yaml_env: Path, with_platform): | |
assert any(x["name"] == "qpot" for x in pkgs) | ||
|
||
|
||
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) | ||
@pytest.mark.parametrize("spec", ("xtensor", "xtensor=0.24.5")) | ||
def test_whoneeds_not_installed_with_channel_no_json(yaml_env: Path, spec): | ||
res = helpers.umamba_repoquery("whoneeds", "-c", "conda-forge", spec, "--platform", "osx-64") | ||
assert "Name Version Build Depends Channel Subdir" in helpers.remove_whitespaces(res) | ||
if spec == "xtensor=0.24.5": # `Depends` column is empty here (bug?) | ||
assert "cascade 0.1.1 py38h5ce3968_0 conda-forge osx-64" in helpers.remove_whitespaces(res) | ||
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. Not sure if the current behavior in this case (specifying the spec version) is the appropriate one (need to look into it more with maybe more context). 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. The first builds of {
"arch": "x86_64",
"build": "py310ha6c322b_0",
"build_number": 0,
"depends": [
"boost-cpp >=1.78.0,<1.79.0a0",
"fmt >=9.1.0,<10.0a0",
"hdf5 >=1.12.2,<1.12.3.0a0",
"heyoka >=0.21.0",
"heyoka >=0.21.0,<0.22.0a0",
"heyoka.py >=0.21.0",
"libcxx >=14.0.6",
"numpy",
"pybind11-abi 4",
"python >=3.10,<3.11.0a0",
"python_abi 3.10.* *_cp310",
"spdlog >=1.11.0,<1.12.0a0",
"tbb >=2021.8.0",
"xtensor",
"xtensor-blas"
],
"license": "MPL-2.0",
"name": "cascade",
"platform": "osx",
"subdir": "osx-64",
"timestamp": 1677367283346,
"version": "0.1.1"
} Probably those builds of I think
What do you think? |
||
else: | ||
assert ( | ||
"cascade 0.1.1 py38h5ce3968_0 xtensor conda-forge osx-64" | ||
in helpers.remove_whitespaces(res) | ||
) | ||
Hind-M marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) | ||
def test_whoneeds_tree(yaml_env: Path): | ||
res = helpers.umamba_repoquery("whoneeds", "-c", "conda-forge", "xtensor=0.24.5", "--tree") | ||
|
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.
This is the bug as
cmds
andargs
were refering to sfmt after it was out of scope, and this was only appearing in osx and windows...