Created
November 18, 2020 16:05
-
-
Save davidlatwe/043b4c6216ebb94c325305d9f7a23343 to your computer and use it in GitHub Desktop.
Testing Rez's package not found detailed message
This file contains hidden or 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
import os | |
os.environ["REZ_PACKAGES_PATH"] = "memory@any" | |
def memory_repository(packages): | |
from rez.package_repository import package_repository_manager | |
repository = package_repository_manager.get_repository("memory@any") | |
repository.data = packages | |
if __name__ == "__main__": | |
from rez.resolved_context import ResolvedContext | |
from rez.exceptions import PackageFamilyNotFoundError | |
memory_repository({ | |
# Package not found | |
"dummy": { | |
"1": { | |
"name": "dummy", | |
"version": "1", | |
"requires": [ | |
"oops==1", | |
], | |
}, | |
"2": { | |
"name": "dummy", | |
"version": "2", | |
"requires": [ | |
"oops==2", | |
], | |
} | |
}, | |
# Package not found | |
"miely": { | |
"1": { | |
"name": "miely", | |
"version": "1", | |
"requires": [ | |
"dummy>1", | |
], | |
} | |
}, | |
"jojo": { | |
"1": { | |
"name": "jojo", | |
"version": "1", | |
"requires": [ | |
"oops>1", | |
], | |
} | |
}, | |
}) | |
print("\nRequired package not found") | |
print("=" * 20) | |
try: | |
context = ResolvedContext(["dummy"]) | |
except PackageFamilyNotFoundError as e: | |
print(e) | |
print("\nRequired package not found (deeper)") | |
print("=" * 20) | |
try: | |
context = ResolvedContext(["miely"]) | |
except PackageFamilyNotFoundError as e: | |
print(e) | |
print("\nRequired package not found (multiple)") | |
print("=" * 20) | |
try: | |
context = ResolvedContext(["dummy", "jojo"]) | |
except PackageFamilyNotFoundError as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment