Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging variants sorting algo #165

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rez/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def _solve(self):
package_cache = PackageVariantCache(
self.package_paths,
timestamp=self.timestamp,
package_requests=self.package_requests,
package_load_callback=self.package_load_callback,
building=self.building)

Expand Down
1,093 changes: 742 additions & 351 deletions src/rez/solver.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = 'asymmetric_variants'
version = '1'
authors = ["oops"]
uuid = "dfd5e678-846a-4e8f-94d2-fc5927c17648"
description = "package with asymmetric variants"
variants = [
["bah-2.0.0"],
["eek-1.0.1", "bah-1.0.0"],
["eek-1.0.0"]]
5 changes: 5 additions & 0 deletions src/rez/tests/data/solver/packages/bah/1.0.0/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = 'bah'
version = '1.0.0'
authors = ["bah"]
uuid = "a01e3fe0-c009-4413-b681-a7bb1ce967d7"
description = "bah thing"
6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/bah/1.0.1/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'bah'
version = '1.0.1'
authors = ["bah"]
uuid = "a01e3fe0-c009-4413-b681-a7bb1ce967d7"
description = "bah thing"

6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/bah/2.0.0/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'bah'
version = '2.0.0'
authors = ["bah"]
uuid = "a01e3fe0-c009-4413-b681-a7bb1ce967d7"
description = "bah thing"

6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/bar/4.5.3/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'bar'
version = '4.5.3'
authors = ["bar"]
uuid = "4e0d17db-b270-4667-897e-4f4b83bdaf7d"
description = "bar thing"

6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/bar/4.8.2/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'bar'
version = '4.8.2'
authors = ["bar"]
uuid = "4e0d17db-b270-4667-897e-4f4b83bdaf7d"
description = "bar thing"

6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/bar/4.8.5/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'bar'
version = '4.8.5'
authors = ["bar"]
uuid = "4e0d17db-b270-4667-897e-4f4b83bdaf7d"
description = "bar thing"

5 changes: 5 additions & 0 deletions src/rez/tests/data/solver/packages/eek/1.0.0/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = 'eek'
version = '1.0.0'
authors = ["eek"]
uuid = "0c077c54-5968-4fad-aa6e-43fac9805c86"
description = "eek thing"
6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/eek/1.0.1/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'eek'
version = '1.0.1'
authors = ["eek"]
uuid = "0c077c54-5968-4fad-aa6e-43fac9805c86"
description = "eek thing"

6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/eek/2.0.0/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'eek'
version = '2.0.0'
authors = ["eek"]
uuid = "0c077c54-5968-4fad-aa6e-43fac9805c86"
description = "eek thing"

6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/foo/1.0.0/foo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os

__version__ = os.getenv("REZ_FOO_VERSION")

def report():
return "hello from foo-%s" % __version__
6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/foo/1.0.0/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'foo'
version = '1.0.0'
authors = ["joe.bloggs"]
uuid = "8031b8a1b1994ea8af86376647fbe530"
description = "foo thing"

5 changes: 5 additions & 0 deletions src/rez/tests/data/solver/packages/foo/1.0.0/rezbuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def build(source_path, build_path, install_path, targets):

pass

6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/foo/1.1.0/foo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os

__version__ = os.getenv("REZ_FOO_VERSION")

def report():
return "hello from foo-%s" % __version__
6 changes: 6 additions & 0 deletions src/rez/tests/data/solver/packages/foo/1.1.0/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = 'foo'
version = '1.1.0'
authors = ["joe.bloggs"]
uuid = "8031b8a1b1994ea8af86376647fbe530"
description = "foo thing"

5 changes: 5 additions & 0 deletions src/rez/tests/data/solver/packages/foo/1.1.0/rezbuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

def build(source_path, build_path, install_path, targets):

pass

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name = 'multi_packages_variant_sorted'
version = '1'
authors = ["oops"]
uuid = "5e0b535e-a32b-4825-ae54-f88589f4bd79"
description = "package with multi packages in variants sorted"
variants = [
["bah-1.0.0", "eek-1.0.0" ],
["bah-1.0.0", "eek-1.0.1" ],
["bah-1.0.0", "eek-2.0.0" ],
["bah-1.0.1", "eek-1.0.0" ],
["bah-1.0.1", "eek-1.0.1" ],
["bah-1.0.1", "eek-2.0.0" ],
["bah-2.0.0", "eek-1.0.0" ],
["bah-2.0.0", "eek-1.0.1" ],
["bah-2.0.0", "eek-2.0.0" ],
["bah-1.0.0", "bar-4.5.3" ],
["bah-1.0.0", "bar-4.8.2" ],
["bah-1.0.0", "bar-4.8.5" ],
["bah-1.0.1", "bar-4.5.3" ],
["bah-1.0.1", "bar-4.8.2" ],
["bah-1.0.1", "bar-4.8.5" ],
["bah-2.0.0", "bar-4.5.3" ],
["bah-2.0.0", "bar-4.8.2" ],
["bah-2.0.0", "bar-4.8.5" ]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name = 'multi_packages_variant_unsorted'
version = '1'
authors = ["oops"]
uuid = "i73c9a11c-fa41-482b-bb38-867c7e19c6f9"
description = "package with multi packages in variants unsorted"
variants = [
["bah-2.0.0", "bar-4.8.2" ],
["bah-1.0.0", "eek-1.0.1" ],
["bah-1.0.1", "eek-1.0.0" ],
["bah-2.0.0", "bar-4.8.5" ],
["bah-1.0.0", "eek-1.0.0" ],
["bah-2.0.0", "eek-1.0.0" ],
["bah-1.0.1", "bar-4.8.2" ],
["bah-1.0.1", "eek-1.0.1" ],
["bah-1.0.1", "bar-4.5.3" ],
["bah-2.0.0", "eek-2.0.0" ],
["bah-1.0.0", "bar-4.8.2" ],
["bah-1.0.1", "eek-2.0.0" ],
["bah-1.0.0", "bar-4.8.5" ],
["bah-1.0.0", "eek-2.0.0" ],
["bah-1.0.1", "bar-4.8.5" ],
["bah-2.0.0", "bar-4.5.3" ],
["bah-2.0.0", "eek-1.0.1" ],
["bah-1.0.0", "bar-4.5.3" ]]


Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = 'multi_version_variant_higher_to_lower_version_order'
version = '1'
authors = ["oops"]
uuid = "ed8a45e3-233e-4341-8ba9-9d53c470658c"
description = "package with several variants of bar ordered from higher lower version"
variants = [
["bar-4.8.5"],
["bar-4.8.2"],
["bar-4.5.3"]]

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = 'multi_version_variant_lower_to_higher_version_order'
version = '1'
authors = ["oops"]
uuid = "ed8a45e3-233e-4341-8ba9-9d53c470658c"
description = "package with several variants of bar ordered from lower to higher version"
variants = [
["bar-4.5.3"],
["bar-4.8.2"],
["bar-4.8.5"]]

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name = 'package_name_in_require_and_variant'
version = '1'
authors = ["oops"]
uuid = "eb06492a-540c-4db4-9110-a86883f1f9e4"
description = "requires is on variants as well"
requires = ["bah"]
variants = [
["eek-1.0.1", "bah-1.0.0"],
["eek-1.0.1", "bah-2.0.0"]]


Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = 'permuted_family_names'
version = '1'
authors = ["oops"]
uuid = "ac1bc95a-35c5-4242-a9f1-b1c85fda8a61"
description = "family name permuted in the variants"
variants = [
["bah-1.0.1", "eek-1.0.0"],
["eek-1.0.1", "bah-2.0.0"]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = 'permuted_family_names_same_position_weight'
version = '1'
authors = ["oops"]
uuid = "9f4defbe-ad1d-4f88-a43f-b298d79ebfe9"
description = "family name permuted in the variants all with same average positional weight"
variants = [
["bah-1.0.1", 'foo-1.0.0', 'eek-1.0.1'],
["eek-1.0.1", "bah-2.0.0", 'foo-1.0.0'],
["foo-1.1.0", "eek-1.0.0", 'bah-2.0.0']]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = 'three_packages_in_variant'
version = '1'
authors = ["oops"]
uuid = "40f2650b-6150-4ad5-8646-5dd08d284a1e"
description = "package with three packages in variants "
variants = [
["bah-1.0.1", "python-2.7", "eek-1.0.0"],
["bah-1.0.1", "python-2.6", "eek-1.0.0"],
["bah-1.0.1", "python-2.5", "eek-1.0.0"],
["bah-1.0.1", "python-2.7", "eek-1.0.1"],
["bah-1.0.1", "python-2.6", "eek-1.0.1"],
["bah-1.0.1", "python-2.5", "eek-1.0.1"],
["bah-1.0.1", "python-2.7", "eek-2.0.0"],
["bah-1.0.1", "python-2.6", "eek-2.0.0"],
["bah-1.0.1", "python-2.5", "eek-2.0.0"]]

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name = 'two_packages_in_variant_unsorted'
version = '1'
authors = ["oops"]
uuid = "1c84af87-db67-4734-a1f0-f1a09e3f0dbe"
description = "package with two packages in variants "
variants = [
["bah-1.0.1", "eek-1.0.1"],
["bah-1.0.1", "eek-2.0.0"],
["bah-2.0.0", "eek-1.0.0"],
["bah-2.0.0", "eek-1.0.1"],
["bah-1.0.0", "eek-1.0.1"],
["bah-1.0.0", "eek-2.0.0"]]


Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = 'variable_variant_package_in_single_column'
version = '1'
authors = ["oops"]
uuid = "52400418-4180-4c58-ad4b-e8bcd7896d2e"
description = "package with variants with different package name in the same column "
variants = [
["foo-1.1.0", "eek-1.0.1"],
["foo-1.0.0", "bah-1.0.1"]]

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = 'variant_with_antipackage'
version = '1'
authors = ["oops"]
uuid = "ca952d6d-5eec-46f7-a8fd-31aa95c826b7"
description = "package with an antipackage in the variant"
variants = [
["bah-1.0.0"],
["bah-1.0.1"],
["!bah-2.0.0"]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = 'variant_with_weak_package_in_variant'
version = '1'
authors = ["oops"]
uuid = "2b95f39c-1ae2-4080-a7a7-3f2062e5a65d"
description = "package with a weak ref in the variant"
variants = [
["bah-1.0.0"],
["bah-1.0.1"],
["~bah-2.0.0"]]
18 changes: 18 additions & 0 deletions src/rez/tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@
'pyson-1', 'pyson-2',
'pysplit-5', 'pysplit-6', 'pysplit-7',
'python-2.5.2', 'python-2.6.0', 'python-2.6.8', 'python-2.7.0',
# variant solver
'variable_variant_package_in_single_column',
'package_name_in_require_and_variant',
'bar-4.8.5', 'bar-4.8.2', 'bar-4.5.3',
'three_packages_in_variant',
'multi_version_variant_higher_to_lower_version_order',
'multi_version_variant_lower_to_higher_version_order',
'asymmetric_variants',
'permuted_family_names_same_position_weight',
'variant_with_antipackage',
'multi_packages_variant_unsorted',
'eek-2.0.0', 'eek-1.0.1', 'eek-1.0.0',
'variant_with_weak_package_in_variant',
'permuted_family_names',
'foo-1.0.0', 'foo-1.1.0',
'multi_packages_variant_sorted',
'bah-2.0.0', 'bah-1.0.1', 'bah-1.0.0',
'two_packages_in_variant_unsorted',
# packages from data/packages
'unversioned',
'unversioned_py',
Expand Down
Loading