rez.package_order
- class rez.package_order.NullPackageOrder[source]
Bases:
rez.package_order.PackageOrderAn orderer that does not change the order - a no op.
This orderer is useful in cases where you want to apply some default orderer to a set of packages, but may want to explicitly NOT reorder a particular package. You would use a NullPackageOrder in a PerFamilyOrder to do this.
- name = 'no_order'
- reorder(iterable, key=None)[source]
Put packages into some order for consumption.
You can safely assume that the packages referred to by iterable are all versions of the same package family.
Note
Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.
- Parameters
iterable – Iterable list of packages, or objects that contain packages.
key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.
- Returns
List of iterable type, reordered.
- class rez.package_order.PackageOrder[source]
Bases:
objectPackage reorderer base class.
- name = None
- reorder(iterable, key=None)[source]
Put packages into some order for consumption.
You can safely assume that the packages referred to by iterable are all versions of the same package family.
Note
Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.
- Parameters
iterable – Iterable list of packages, or objects that contain packages.
key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.
- Returns
List of iterable type, reordered.
- property sha1
- class rez.package_order.PackageOrderList(iterable=(), /)[source]
Bases:
listA list of package orderer.
- class rez.package_order.PerFamilyOrder(order_dict, default_order=None)[source]
Bases:
rez.package_order.PackageOrderAn orderer that applies different orderers to different package families.
- name = 'per_family'
- reorder(iterable, key=None)[source]
Put packages into some order for consumption.
You can safely assume that the packages referred to by iterable are all versions of the same package family.
Note
Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.
- Parameters
iterable – Iterable list of packages, or objects that contain packages.
key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.
- Returns
List of iterable type, reordered.
- class rez.package_order.SortedOrder(descending)[source]
Bases:
rez.package_order.PackageOrderAn orderer that sorts wrt version.
- name = 'sorted'
- reorder(iterable, key=None)[source]
Put packages into some order for consumption.
You can safely assume that the packages referred to by iterable are all versions of the same package family.
Note
Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.
- Parameters
iterable – Iterable list of packages, or objects that contain packages.
key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.
- Returns
List of iterable type, reordered.
- class rez.package_order.TimestampPackageOrder(timestamp, rank=0)[source]
Bases:
rez.package_order.PackageOrderA timestamp order function.
Given a time T, this orderer returns packages released before T, in descending order, followed by those released after. If rank is non-zero, version changes at that rank and above are allowed over the timestamp.
For example, consider the common case where we want to prioritize packages released before T, except for newer patches. Consider the following package versions, and time T:
2.2.1 2.2.0 2.1.1 2.1.0 2.0.6 2.0.5
<– T
2.0.0 1.9.0
A timestamp orderer set to rank=3 (patch versions) will attempt to consume the packages in the following order:
2.0.6 2.0.5 2.0.0 1.9.0 2.1.1 2.1.0 2.2.1 2.2.0
Notice that packages before T are preferred, followed by newer versions. Newer versions are consumed in ascending order, except within rank (this is why 2.1.1 is consumed before 2.1.0).
- name = 'soft_timestamp'
- reorder(iterable, key=None)[source]
Put packages into some order for consumption.
You can safely assume that the packages referred to by iterable are all versions of the same package family.
Note
Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.
- Parameters
iterable – Iterable list of packages, or objects that contain packages.
key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.
- Returns
List of iterable type, reordered.
- class rez.package_order.VersionSplitPackageOrder(first_version)[source]
Bases:
rez.package_order.PackageOrderOrders package versions <= a given version first.
For example, given the versions [5, 4, 3, 2, 1], an orderer initialized with version=3 would give the order [3, 2, 1, 5, 4].
- name = 'version_split'
- reorder(iterable, key=None)[source]
Put packages into some order for consumption.
You can safely assume that the packages referred to by iterable are all versions of the same package family.
Note
Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.
- Parameters
iterable – Iterable list of packages, or objects that contain packages.
key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.
- Returns
List of iterable type, reordered.