本文整理汇总了Python中depsolver.pool.Pool类的典型用法代码示例。如果您正苦于以下问题:Python Pool类的具体用法?Python Pool怎么用?Python Pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_package_by_id_simple
def test_package_by_id_simple(self):
repo = Repository([self.mkl_10_1_0, self.mkl_10_2_0])
pool = Pool()
pool.add_repository(repo)
self.assertEqual(self.mkl_10_1_0, pool.package_by_id(self.mkl_10_1_0.id))
self.assertEqual(self.mkl_10_2_0, pool.package_by_id(self.mkl_10_2_0.id))
示例2: setUp
def setUp(self):
self.mkl_10_1_0 = P("mkl-10.1.0")
self.mkl_10_2_0 = P("mkl-10.2.0")
self.mkl_10_3_0 = P("mkl-10.3.0")
self.mkl_11_0_0 = P("mkl-11.0.0")
self.numpy_1_6_0 = P("numpy-1.6.0; depends (mkl)")
self.numpy_1_6_1 = P("numpy-1.6.1; depends (mkl)")
self.numpy_1_7_0 = P("numpy-1.7.0; depends (mkl)")
self.nomkl_numpy_1_6_0 = P("nomkl_numpy-1.6.0; provides(numpy == 1.6.0)")
self.nomkl_numpy_1_6_1 = P("nomkl_numpy-1.6.1; provides(numpy == 1.6.1)")
self.nomkl_numpy_1_7_0 = P("nomkl_numpy-1.7.0; provides(numpy == 1.7.0)")
self.mkl_numpy_1_6_1 = P("mkl_numpy-1.6.1; provides(numpy == 1.6.1); depends (mkl)")
self.mkl_numpy_1_7_0 = P("mkl_numpy-1.7.0; provides(numpy == 1.7.0); depends (mkl)")
self.scipy_0_11_0 = P("scipy-0.11.0; depends (numpy >= 1.4.0)")
self.scipy_0_12_0 = P("scipy-0.12.0; depends (numpy >= 1.4.0)")
self.matplotlib_1_2_0 = P("matplotlib-1.2.0; depends (numpy >= 1.6.0)")
repo = Repository([self.mkl_10_1_0, self.mkl_10_2_0, self.mkl_10_3_0,
self.mkl_11_0_0, self.numpy_1_6_0])
pool = Pool()
pool.add_repository(repo)
self.pool = pool
示例3: test_complex_scenario_1
def test_complex_scenario_1(self):
repo = Repository([mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0,
numpy_1_6_0, numpy_1_6_1, numpy_1_7_0, scipy_0_11_0, scipy_0_12_0])
pool = Pool()
pool.add_repository(repo)
r_rules = set()
r_rules.add(PackageRule.from_string("scipy-0.11.0 | scipy-0.12.0", pool))
r_rules.add(PackageRule.from_string("-scipy-0.11.0 | -scipy-0.12.0", pool))
r_rules.add(PackageRule.from_string(
"-scipy-0.11.0 | numpy-1.6.0 | numpy-1.6.1 | numpy-1.7.0",
pool))
r_rules.add(PackageRule.from_string(
"-scipy-0.12.0 | numpy-1.6.0 | numpy-1.6.1 | numpy-1.7.0",
pool))
r_rules.add(PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.1", pool))
r_rules.add(PackageRule.from_string("-numpy-1.7.0 | -numpy-1.6.0", pool))
r_rules.add(PackageRule.from_string("-numpy-1.6.0 | -numpy-1.6.1", pool))
r_rules.add(PackageRule.from_string(
"-numpy-1.7.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool))
r_rules.add(PackageRule.from_string(
"-numpy-1.6.1 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool))
r_rules.add(PackageRule.from_string(
"-numpy-1.6.0 | mkl-10.1.0 | mkl-10.2.0 | mkl-10.3.0 | mkl-11.0.0", pool))
r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.2.0", pool))
r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-10.3.0", pool))
r_rules.add(PackageRule.from_string("-mkl-10.1.0 | -mkl-11.0.0", pool))
r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-10.3.0", pool))
r_rules.add(PackageRule.from_string("-mkl-10.2.0 | -mkl-11.0.0", pool))
r_rules.add(PackageRule.from_string("-mkl-10.3.0 | -mkl-11.0.0", pool))
self.assertEqual(r_rules,
set(create_install_rules(pool, R("scipy"))))
示例4: test_matches
def test_matches(self):
pool = Pool()
self.assertEqual(pool.matches(self.mkl_10_1_0, R("mkl")), MATCH)
self.assertEqual(pool.matches(self.mkl_10_1_0, R("mkl >= 10.2.0")), MATCH_NAME)
self.assertEqual(pool.matches(self.mkl_10_1_0, R("numpy")), False)
self.assertEqual(pool.matches(self.nomkl_numpy_1_7_0, R("numpy")), MATCH_PROVIDE)
示例5: test_simple2
def test_simple2(self):
repo = Repository([self.mkl_10_1_0, self.mkl_10_2_0])
pool = Pool([repo])
self.assertEqual(self.mkl_10_1_0, pool.package_by_id(self.mkl_10_1_0.id))
self.assertEqual(self.mkl_10_2_0, pool.package_by_id(self.mkl_10_2_0.id))
self.assertRaises(MissingPackageInfoInPool, lambda: pool.package_by_id(self.mkl_10_3_0.id))
示例6: test_literal_to_string
def test_literal_to_string(self):
pool = Pool([Repository([self.mkl_10_1_0, self.mkl_10_2_0])])
self.assertEqual(pool.id_to_string(self.mkl_10_2_0.id),
"+mkl-10.2.0")
self.assertEqual(pool.id_to_string(-self.mkl_10_1_0.id),
"-mkl-10.1.0")
示例7: test_what_provides_replaces
def test_what_provides_replaces(self):
scikit_learn = P("scikit_learn-0.12.0")
sklearn = P("sklearn-0.13.0; replaces (scikit_learn==0.12.0)")
pool = Pool([Repository([scikit_learn, sklearn])])
self.assertEqual(set(pool.what_provides(R("sklearn"))), set([sklearn]))
self.assertEqual(set(pool.what_provides(R("scikit_learn"))), set([sklearn, scikit_learn]))
示例8: setUp
def setUp(self):
repo = Repository([mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_0,
numpy_1_6_0, numpy_1_6_1, numpy_1_7_0])
pool = Pool()
pool.add_repository(repo)
self.pool = pool
示例9: test_simple
def test_simple(self):
repo1 = Repository([mkl_10_1_0, mkl_10_2_0])
pool = Pool()
pool.add_repository(repo1)
self.assertEqual(mkl_10_1_0, pool.package_by_id(mkl_10_1_0.id))
self.assertEqual(mkl_10_2_0, pool.package_by_id(mkl_10_2_0.id))
self.assertRaises(MissingPackageInPool, lambda: pool.package_by_id(mkl_10_3_0.id))
示例10: test_simple
def test_simple(self):
"""Numpy depends on MKL, one version of NumPy only."""
repo = Repository([mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_0])
pool = Pool()
pool.add_repository(repo)
installed_repo = Repository()
operations = solve(pool, R("numpy"), installed_repo, policy)
self.assertEqual(operations, [Install(mkl_11_0_0), Install(numpy_1_6_0)])
示例11: test_simple2
def test_simple2(self):
"""Numpy depends on MKL, ensure we install the most up-to-date version."""
repo = Repository([mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_0, numpy_1_7_0])
pool = Pool()
pool.add_repository(repo)
installed_repo = Repository()
operations = solve(pool, R("numpy"), installed_repo, policy)
self.assertEqual(operations, [Install(mkl_11_0_0), Install(numpy_1_7_0)])
示例12: test_dependency_already_provided_but_older
def test_dependency_already_provided_but_older(self):
"""Numpy depends on MKL, older MKL already installed."""
repo = Repository([mkl_10_2_0, mkl_10_3_0, mkl_11_0_0, numpy_1_6_0, numpy_1_7_0])
pool = Pool()
pool.add_repository(repo)
installed_repo = Repository([mkl_10_3_0])
operations = solve(pool, R("numpy"), installed_repo, policy)
self.assertEqual(operations, [Install(numpy_1_7_0)])
示例13: test_simple_provided
def test_simple_provided(self):
r_operations = [Install(nomkl_numpy_1_7_0), Install(scipy_0_11_0)]
repo = Repository([mkl_11_0_0, scipy_0_11_0, nomkl_numpy_1_7_0])
pool = Pool()
pool.add_repository(repo)
installed_repo = Repository()
operations = solve(pool, R("scipy"), installed_repo, policy)
self.assertEqual(operations, r_operations)
示例14: test_simple
def test_simple(self):
r_id = [1, 2]
repo1 = Repository(packages=[self.mkl_10_1_0, self.mkl_10_2_0])
pool = Pool()
pool.add_repository(repo1)
self.assertEqual(self.mkl_10_1_0.id, r_id[0])
self.assertEqual(self.mkl_10_2_0.id, r_id[1])
self.assertRaises(MissingPackageInfoInPool, lambda: pool.package_by_id(self.mkl_10_3_0.id))
示例15: test_no_install
def test_no_install(self):
"""Ensure the most up-to-date version is installed when directly installed."""
repo = Repository([mkl_10_1_0, mkl_10_2_0, mkl_10_3_0, mkl_11_0_0])
pool = Pool()
pool.add_repository(repo)
installed_repo = Repository()
operations = solve(pool, R("mkl"), installed_repo, policy)
self.assertEqual(operations, [Install(mkl_11_0_0)])