Created
September 18, 2013 19:33
-
-
Save cournape/6614340 to your computer and use it in GitHub Desktop.
Depsolver with alternative version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from depsolver import PackageInfo, Repository, Pool, Request, Requirement, Solver | |
from depsolver.debian_version import DebianVersion | |
P = PackageInfo.from_string | |
R = Requirement.from_string | |
V = DebianVersion.from_string | |
a_1_0_0 = P("A-1.0.0~1; depends (B, C)", V) | |
b_1_0_0 = P("B-1.0.0~1; depends (D <= 1.1.0~1)", V) | |
c_1_0_0 = P("C-1.0.0~1; depends (D <= 0.9.0~1)", V) | |
d_1_1_0 = P("D-1.1.0~1", V) | |
d_0_9_0 = P("D-0.9.0~1", V) | |
repo = Repository([a_1_0_0, b_1_0_0, c_1_0_0, d_1_1_0, d_0_9_0]) | |
installed_repo = Repository() | |
pool = Pool([repo, installed_repo]) | |
# despolver resolves each dependency 'globally', and does not install | |
# D-1.1.0 as pip currently does | |
request = Request(pool) | |
request.install(R("A", V)) | |
for operation in Solver(pool, installed_repo).solve(request): | |
print operation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment