On Windows, the rez.packages.get_package_from_uri() function returns None for any packages that have one or more uppercase characters in either their package or version name (when using the FilesystemPackageRepository. This also affects the get_variant_from_uri() method from the same module that calls it as well.
From what I can tell, the culprit is here where the URI path is lower-cased before all the subsequent comparison checks, but the subsequent checks for package and version through .get_package() are checking against the non-normalised versions, so they don't match:
|
uri = os.path.normcase(uri) |
This was introduced a few years in the following PR, which was also to address issues around finding variants on Windows so I'm not sure what reverting this change could break:
#1011
This leads to any variants on these packages not being able to be added to the package cache manually using rez-pkg-cache, as it will give the following error:
$ rez-pkg-cache -a "\\storage\pipeline\rez\packages\prod\ext\arch\AMD64\package.py[0]"
No such variant: \\storage\pipeline\rez\packages\prod\ext\arch\AMD64\package.py[0]
This seems to still work for the normal rez-env case as you already have the Variant objects from the resolve - the issue here is getting from the URI input to the actual Variant API object.
Environment
- OS: Windows 11 25H2
- Rez version: 3.1.1
- Rez python version: 3.10.10
To Reproduce
API
- On Windows, find a package that has at least one uppercase character in either the package name of version, e.g (
Pyside6 or arch-AMD64) and get the full URI for it:
> rez-view arch-AMD64
URI:
\\storage\pipeline\rez\packages\prod\ext\arch\AMD64\package.py
...
- Open up a Rez Python shell and run the following snippet, which will show that the API is not able to identify that package by it's URI:
>>> import rez.packages
>>> uri = r"\\storage\pipeline\rez\packages\prod\ext\arch\AMD64\package.py"
>>> print(rez.packages.get_package_from_uri(uri))
If you repeat the test with a package version that has no uppercase characters in either package name or version, a Variant object should be returned.
CLI
- On Windows, find a variant that has at least one uppercase character in either the package name of version, e.g (
Pyside6 or arch-AMD64) and get the full URI for it:
> rez-search arch-AMD64 -t variant -f "{uri}"
\\storage\pipeline\rez\packages\prod\ext\arch\AMD64\package.py[]
- Try to add that URI to the package cache:
> rez-pkg-cache -a "\\storage\pipeline\rez\packages\prod\ext\arch\AMD64\package.py[]"
16:49:43 INFO Adding variant '\\\\storage\\pipeline\\rez\\packages\\prod\\ext\\arch\\AMD64\\package.py' to package cache at C:\...\rez\cache\:
No such variant: \\storage\pipeline\rez\packages\prod\ext\arch\AMD64\package.py
Expected behavior
The rez-pkg-cache command would finish successfully and the rez.packages.get_variant_from_uri() method would return a Variant object.
Actual behavior
Adding the package with an uppercase character to the package cache fails and does not return via the rez.packages.get_variant_from_uri() method.
On Windows, the
rez.packages.get_package_from_uri()function returns None for any packages that have one or more uppercase characters in either their package or version name (when using theFilesystemPackageRepository. This also affects theget_variant_from_uri()method from the same module that calls it as well.From what I can tell, the culprit is here where the URI path is lower-cased before all the subsequent comparison checks, but the subsequent checks for package and version through
.get_package()are checking against the non-normalised versions, so they don't match:rez/src/rezplugins/package_repository/filesystem.py
Line 604 in d415b96
This was introduced a few years in the following PR, which was also to address issues around finding variants on Windows so I'm not sure what reverting this change could break:
#1011
This leads to any variants on these packages not being able to be added to the package cache manually using
rez-pkg-cache, as it will give the following error:This seems to still work for the normal
rez-envcase as you already have theVariantobjects from the resolve - the issue here is getting from the URI input to the actualVariantAPI object.Environment
To Reproduce
API
Pyside6orarch-AMD64) and get the full URI for it:If you repeat the test with a package version that has no uppercase characters in either package name or version, a
Variantobject should be returned.CLI
Pyside6orarch-AMD64) and get the full URI for it:Expected behavior
The
rez-pkg-cachecommand would finish successfully and therez.packages.get_variant_from_uri()method would return aVariantobject.Actual behavior
Adding the package with an uppercase character to the package cache fails and does not return via the
rez.packages.get_variant_from_uri()method.