diff --git a/.gitignore b/.gitignore index 2d5ca726..c59a80cd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ __pycache__ # Do not keep tests and coverage results .pytest_cache .coverage + +# To avoid cluttering when switching branch with 'rust-rewrite' branch. +/rust diff --git a/portablemc/standard.py b/portablemc/standard.py index 7084096e..152f3c27 100644 --- a/portablemc/standard.py +++ b/portablemc/standard.py @@ -643,6 +643,16 @@ def _resolve_libraries(self, watcher: Watcher) -> None: if minecraft_arch_bits is not None: spec.classifier = spec.classifier.replace("${arch}", str(minecraft_arch_bits)) + # Changed in 4.3.1, rules are checked after natives + rules = library.get("rules") + if rules is not None: + + if not isinstance(rules, list): + raise ValueError(f"metadata: /libraries/{library_idx}/rules must be a list") + + if not interpret_rule(rules, self._features, f"metadata: /libraries/{library_idx}/rules"): + continue + # Create a wildcard copy of the spec without version, because we don't # want to match against version, regardless of its version, a library # should not be added twice. @@ -656,16 +666,6 @@ def _resolve_libraries(self, watcher: Watcher) -> None: continue unique_specs.add(spec_wild) - # Changed in 4.3.1, rules are checked after natives - rules = library.get("rules") - if rules is not None: - - if not isinstance(rules, list): - raise ValueError(f"metadata: /libraries/{library_idx}/rules must be a list") - - if not interpret_rule(rules, self._features, f"metadata: /libraries/{library_idx}/rules"): - continue - lib_entry: Optional[DownloadEntry] = None # Avoids ready downloading if a fix is being used, in such case we'll use