-
Notifications
You must be signed in to change notification settings - Fork 168
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
Add support for virtual_specs
checks before installation
#809
Changes from all commits
46c8f19
65ddaba
39b61cd
75dfbfa
b6c4233
d9f7133
a017d7d
220f762
2960219
b36495f
26ccbe4
39f689d
3154b02
247bd45
fd55c51
5399871
ec575b6
df02fbd
8600666
adcbab9
263bd0e
b17085e
ab60642
8b9146c
553b41a
86b958d
6576d53
28f74d5
a59d2c5
858586d
4f46d6c
3930766
4c6664f
471bad4
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 |
---|---|---|
|
@@ -282,3 +282,30 @@ def check_required_env_vars(env_vars): | |
raise RuntimeError( | ||
f"Missing required environment variables {', '.join(missing_vars)}." | ||
) | ||
|
||
|
||
def parse_virtual_specs(info) -> dict: | ||
from .conda_interface import MatchSpec # prevent circular import | ||
|
||
specs = {"__osx": {}, "__glibc": {}} | ||
for spec in info.get("virtual_specs", ()): | ||
spec = MatchSpec(spec) | ||
if spec.name not in ("__osx", "__glibc"): | ||
continue | ||
if not spec.version: | ||
continue | ||
if "|" in spec.version.spec_str: | ||
raise ValueError("Can't process `|`-joined versions. Only `,` is allowed.") | ||
versions = spec.version.tup if "," in spec.version.spec_str else (spec.version,) | ||
for version in versions: | ||
operator = version.operator_func.__name__ | ||
if operator == "ge": | ||
specs[spec.name]["min"] = str(version.matcher_vo) | ||
elif operator == "lt" and spec.name == "__osx": | ||
specs[spec.name]["before"] = str(version.matcher_vo) | ||
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. Maybe I'm still jet lagged, but is this used anywhere? 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. Yes, at https://github.com/conda/constructor/pull/809/files#diff-620cc606622328c2ee309e832c215dbf23da87df82a5b10bd09ced66c2f9b503R200 ('before' it's part of the XML attributes that key accepts) |
||
else: | ||
raise ValueError( | ||
f"Invalid version operator for {spec}. " | ||
"__osx only supports `<` or `>=`; __glibc only supports `>=`." | ||
) | ||
return specs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: virtual_specs | ||
|
||
version: 0.0.1 | ||
|
||
keep_pkgs: True | ||
|
||
channels: | ||
- conda-forge | ||
|
||
specs: | ||
- ca-certificates | ||
|
||
virtual_specs: | ||
- __osx>=30,<31 # [osx] | ||
- __glibc>=20 # [linux] | ||
- __win<0 # [win] | ||
|
||
initialize_by_default: false | ||
register_python: false | ||
check_path_spaces: false | ||
check_path_length: false | ||
installer_type: all |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
### Enhancements | ||
|
||
* A new setting `virtual_specs` allows the installer to run some solver checks before the installation proceeds. Useful for checking whether certain virtual package versions can be satisfied. (#809) | ||
|
||
### Bug fixes | ||
|
||
* <news item> | ||
|
||
### Deprecations | ||
|
||
* <news item> | ||
|
||
### Docs | ||
|
||
* <news item> | ||
|
||
### Other | ||
|
||
* <news item> |
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.
Is the condo exe compatible with a much lower bound than one would otherwise expect. Say 2.12 on Linux.
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.
Is seems that on Linux you use ldd but that on osx you use a dry run.
any way to also use shell commands on osx? I feel like that would be more robust to increases in minimum requirements in osx
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.
It's there:
https://github.com/conda/constructor/pull/809/files#diff-d5126ee7f99e6583ba9574579ff73994eaf0eebcfdc792a6deb00a0dc2158f6eR24-R35
And also for PKG:
https://github.com/conda/constructor/pull/809/files#diff-620cc606622328c2ee309e832c215dbf23da87df82a5b10bd09ced66c2f9b503R193-R203
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.
amazing, thanks!