Skip to content

Instantly share code, notes, and snippets.

@davidlatwe
Created November 18, 2020 16:05
Show Gist options
  • Save davidlatwe/043b4c6216ebb94c325305d9f7a23343 to your computer and use it in GitHub Desktop.
Save davidlatwe/043b4c6216ebb94c325305d9f7a23343 to your computer and use it in GitHub Desktop.
Testing Rez's package not found detailed message
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