nerdvegas/rez — pull request #111 by mstreatfield (2014-10-14 07:01:27+00:00)
Title: Order Resources

Some resources (such as a `VersionedPackageResource`) can be represented by multiple files (a `package.yaml`, `package.py` and `package.txt` *). However, a versioned package can only really be created from one of these - we don't mix and match keys from across the files. However, the resource system is greedy and will always find as many files as it can, even if they are not required. This is wasteful.

This change prioritises `package.py` files over `package.yaml`, and `package.yaml` over `package.txt`. This means that the newer Rez 2 format `package.py` will be used if available (it's also quicker) with a fallback if required.

This is useful for those transitioning to rez 2 (such as me) but are still looking for a performance boost. I want to use `package.py` files as they are quicker to evaluate, but I have rez 1 users so much maintain the `packag.yaml`. Currently this generates two resources for every package - with this change I only get one resource. A 50% saving. Nice.

\* yes, I know a `package.txt` isn't actually valid, but the way the resource classes are written means if the file existed, it would have been found and returned as it matches the variable criteria.