本文整理汇总了Python中conda.resolve.MatchSpec类的典型用法代码示例。如果您正苦于以下问题:Python MatchSpec类的具体用法?Python MatchSpec怎么用?Python MatchSpec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MatchSpec类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_to_filename
def test_to_filename(self):
ms = MatchSpec("foo 1.7 52")
self.assertEqual(ms.to_filename(), "foo-1.7-52.tar.bz2")
for spec in "bitarray", "pycosat 0.6.0", "numpy 1.6*":
ms = MatchSpec(spec)
self.assertEqual(ms.to_filename(), None)
示例2: test_match
def test_match(self):
for spec, res in [
("numpy 1.7*", True),
("numpy 1.7.1", True),
("numpy 1.7", False),
("numpy 1.5*", False),
("numpy >=1.5", True),
("numpy >=1.5,<2", True),
("numpy >=1.8,<1.9", False),
("numpy >1.5,<2,!=1.7.1", False),
("numpy >1.8,<2|==1.7", False),
("numpy >1.8,<2|>=1.7.1", True),
("numpy >=1.8|1.7*", True),
("numpy ==1.7", False),
("numpy >=1.5,>1.6", True),
("numpy ==1.7.1", True),
("numpy >=1,*.7.*", True),
("numpy *.7.*,>=1", True),
("numpy >=1,*.8.*", False),
("numpy >=2,*.7.*", False),
("numpy 1.6*|1.7*", True),
("numpy 1.6*|1.8*", False),
("numpy 1.6.2|1.7*", True),
("numpy 1.6.2|1.7.1", True),
("numpy 1.6.2|1.7.0", False),
("numpy 1.7.1 py27_0", True),
("numpy 1.7.1 py26_0", False),
("python", False),
]:
m = MatchSpec(spec)
self.assertEqual(m.match("numpy-1.7.1-py27_0.tar.bz2"), res)
示例3: test_match
def test_match(self):
for spec, res in [
('numpy 1.7*', True), ('numpy 1.7.1', True),
('numpy 1.7', False), ('numpy 1.5*', False),
('numpy >=1.5', True), ('numpy >=1.5,<2', True),
('numpy >=1.8,<1.9', False), ('numpy >1.5,<2,!=1.7.1', False),
('numpy >1.8,<2|==1.7', False),('numpy >1.8,<2|>=1.7.1', True),
('numpy >=1.8|1.7*', True), ('numpy ==1.7', False),
('numpy >=1.5,>1.6', True), ('numpy ==1.7.1', True),
('numpy >=1,*.7.*', True), ('numpy *.7.*,>=1', True),
('numpy >=1,*.8.*', False), ('numpy >=2,*.7.*', False),
('numpy 1.6*|1.7*', True), ('numpy 1.6*|1.8*', False),
('numpy 1.6.2|1.7*', True), ('numpy 1.6.2|1.7.1', True),
('numpy 1.6.2|1.7.0', False), ('numpy 1.7.1 py27_0', True),
('numpy 1.7.1 py26_0', False), ('numpy >1.7.1a', True),
('python', False),
]:
m = MatchSpec(spec)
self.assertEqual(m.match('numpy-1.7.1-py27_0.tar.bz2'), res)
# both version numbers conforming to PEP 440
self.assertFalse(MatchSpec('numpy >=1.0.1').match('numpy-1.0.1a-0.tar.bz2'))
# both version numbers non-conforming to PEP 440
self.assertFalse(MatchSpec('numpy >=1.0.1.vc11').match('numpy-1.0.1a.vc11-0.tar.bz2'))
self.assertTrue(MatchSpec('numpy >=1.0.1*.vc11').match('numpy-1.0.1a.vc11-0.tar.bz2'))
# one conforming, other non-conforming to PEP 440
self.assertTrue(MatchSpec('numpy <1.0.1').match('numpy-1.0.1.vc11-0.tar.bz2'))
self.assertTrue(MatchSpec('numpy <1.0.1').match('numpy-1.0.1a.vc11-0.tar.bz2'))
self.assertFalse(MatchSpec('numpy >=1.0.1.vc11').match('numpy-1.0.1a-0.tar.bz2'))
self.assertTrue(MatchSpec('numpy >=1.0.1a').match('numpy-1.0.1z-0.tar.bz2'))
示例4: test_match
def test_match(self):
for spec, res in [
('numpy 1.7*', True), ('numpy 1.7.1', True),
('numpy 1.7', False), ('numpy 1.5*', False),
('numpy >=1.5', True), ('numpy >=1.5,<2', True),
('numpy >=1.8,<1.9', False), ('numpy >1.5,<2,!=1.7.1', False),
('numpy >1.8,<2|==1.7', False),('numpy >1.8,<2|>=1.7.1', True),
('numpy >=1.8|1.7*', True), ('numpy ==1.7', False),
('numpy >=1.5,>1.6', True), ('numpy ==1.7.1', True),
('numpy >=1,*.7.*', True), ('numpy *.7.*,>=1', True),
('numpy >=1,*.8.*', False), ('numpy >=2,*.7.*', False),
('numpy 1.6*|1.7*', True), ('numpy 1.6*|1.8*', False),
('numpy 1.6.2|1.7*', True), ('numpy 1.6.2|1.7.1', True),
('numpy 1.6.2|1.7.0', False), ('numpy 1.7.1 py27_0', True),
('numpy 1.7.1 py26_0', False), ('numpy >1.7.1a', True),
('python', False),
]:
m = MatchSpec(spec)
self.assertEqual(m.match(Dist('numpy-1.7.1-py27_0.tar.bz2')), res)
# both version numbers conforming to PEP 440
self.assertFalse(MatchSpec('numpy >=1.0.1').match(Dist('numpy-1.0.1a-0.tar.bz2')))
# both version numbers non-conforming to PEP 440
self.assertFalse(MatchSpec('numpy >=1.0.1.vc11').match(Dist('numpy-1.0.1a.vc11-0.tar.bz2')))
self.assertTrue(MatchSpec('numpy >=1.0.1*.vc11').match(Dist('numpy-1.0.1a.vc11-0.tar.bz2')))
# one conforming, other non-conforming to PEP 440
self.assertTrue(MatchSpec('numpy <1.0.1').match(Dist('numpy-1.0.1.vc11-0.tar.bz2')))
self.assertTrue(MatchSpec('numpy <1.0.1').match(Dist('numpy-1.0.1a.vc11-0.tar.bz2')))
self.assertFalse(MatchSpec('numpy >=1.0.1.vc11').match(Dist('numpy-1.0.1a-0.tar.bz2')))
self.assertTrue(MatchSpec('numpy >=1.0.1a').match(Dist('numpy-1.0.1z-0.tar.bz2')))
self.assertTrue(MatchSpec('numpy >=1.0.1a py27*').match(Dist('numpy-1.0.1z-py27_1.tar.bz2')))
self.assertTrue(MatchSpec('blas * openblas').match(Dist('blas-1.0-openblas.tar.bz2')))
self.assertTrue(MatchSpec('blas').is_simple())
self.assertFalse(MatchSpec('blas').is_exact())
self.assertFalse(MatchSpec('blas 1.0').is_simple())
self.assertFalse(MatchSpec('blas 1.0').is_exact())
self.assertFalse(MatchSpec('blas 1.0 1').is_simple())
self.assertTrue(MatchSpec('blas 1.0 1').is_exact())
self.assertFalse(MatchSpec('blas 1.0 *').is_exact())
m = MatchSpec('blas 1.0', optional=True)
m2 = MatchSpec(m, optional=False)
m3 = MatchSpec(m2, target='blas-1.0-0.tar.bz2')
m4 = MatchSpec(m3, target=None, optional=True)
self.assertTrue(m.spec == m2.spec and m.optional != m2.optional)
self.assertTrue(m2.spec == m3.spec and m2.optional == m3.optional and m2.target != m3.target)
self.assertTrue(m == m4)
self.assertRaises(ValueError, MatchSpec, 'blas (optional')
self.assertRaises(ValueError, MatchSpec, 'blas (optional,test)')
示例5: test_match
def test_match(self):
for spec, res in [('numpy 1.7*', True),
('numpy 1.7.1', True),
('numpy 1.7', False),
('numpy 1.5*', False),
('numpy 1.6*|1.7*', True),
('numpy 1.6*|1.8*', False),
('numpy 1.6.2|1.7*', True),
('numpy 1.6.2|1.7.1', True),
('numpy 1.6.2|1.7.0', False),
('numpy 1.7.1 py27_0', True),
('numpy 1.7.1 py26_0', False),
('python', False)]:
m = MatchSpec(spec)
self.assertEqual(m.match('numpy-1.7.1-py27_0.tar.bz2'), res)
示例6: test_match
def test_match(self):
for spec, res in [
('numpy 1.7*', True), ('numpy 1.7.1', True),
('numpy 1.7', False), ('numpy 1.5*', False),
('numpy >=1.5', True), ('numpy >=1.5,<2', True),
('numpy >=1.8,<1.9', False), ('numpy >1.5,<2,!=1.7.1', False),
('numpy >1.8,<2|==1.7', False),('numpy >1.8,<2|>=1.7.1', True),
('numpy >=1.8|1.7*', True), ('numpy ==1.7', False),
('numpy >=1.5,>1.6', True), ('numpy ==1.7.1', True),
('numpy 1.6*|1.7*', True), ('numpy 1.6*|1.8*', False),
('numpy 1.6.2|1.7*', True), ('numpy 1.6.2|1.7.1', True),
('numpy 1.6.2|1.7.0', False), ('numpy 1.7.1 py27_0', True),
('numpy 1.7.1 py26_0', False), ('python', False),
]:
m = MatchSpec(spec)
self.assertEqual(m.match('numpy-1.7.1-py27_0.tar.bz2'), res)
示例7: test_match
def test_match(self):
for spec, res in [
("numpy 1.7*", True),
("numpy 1.7.1", True),
("numpy 1.7", False),
("numpy 1.5*", False),
("numpy 1.6*|1.7*", True),
("numpy 1.6*|1.8*", False),
("numpy 1.6.2|1.7*", True),
("numpy 1.6.2|1.7.1", True),
("numpy 1.6.2|1.7.0", False),
("numpy 1.7.1 py27_0", True),
("numpy 1.7.1 py26_0", False),
("python", False),
]:
m = MatchSpec(spec)
self.assertEqual(m.match("numpy-1.7.1-py27_0.tar.bz2"), res)
示例8: test_match
def test_match(self):
for spec, res in [
("numpy 1.7*", True),
("numpy 1.7.1", True),
("numpy 1.7", False),
("numpy 1.5*", False),
("numpy >=1.5", True),
("numpy >=1.5,<2", True),
("numpy >=1.8,<1.9", False),
("numpy >1.5,<2,!=1.7.1", False),
("numpy >1.8,<2|==1.7", False),
("numpy >1.8,<2|>=1.7.1", True),
("numpy >=1.8|1.7*", True),
("numpy ==1.7", False),
("numpy >=1.5,>1.6", True),
("numpy ==1.7.1", True),
("numpy >=1,*.7.*", True),
("numpy *.7.*,>=1", True),
("numpy >=1,*.8.*", False),
("numpy >=2,*.7.*", False),
("numpy 1.6*|1.7*", True),
("numpy 1.6*|1.8*", False),
("numpy 1.6.2|1.7*", True),
("numpy 1.6.2|1.7.1", True),
("numpy 1.6.2|1.7.0", False),
("numpy 1.7.1 py27_0", True),
("numpy 1.7.1 py26_0", False),
("numpy >1.7.1a", True),
("python", False),
]:
m = MatchSpec(spec)
self.assertEqual(m.match("numpy-1.7.1-py27_0.tar.bz2"), res)
# both version numbers conforming to PEP 440
self.assertFalse(MatchSpec("numpy >=1.0.1").match("numpy-1.0.1a-0.tar.bz2"))
# both version numbers non-conforming to PEP 440
self.assertFalse(MatchSpec("numpy >=1.0.1.vc11").match("numpy-1.0.1a.vc11-0.tar.bz2"))
self.assertTrue(MatchSpec("numpy >=1.0.1*.vc11").match("numpy-1.0.1a.vc11-0.tar.bz2"))
# one conforming, other non-conforming to PEP 440
self.assertTrue(MatchSpec("numpy <1.0.1").match("numpy-1.0.1.vc11-0.tar.bz2"))
self.assertTrue(MatchSpec("numpy <1.0.1").match("numpy-1.0.1a.vc11-0.tar.bz2"))
self.assertFalse(MatchSpec("numpy >=1.0.1.vc11").match("numpy-1.0.1a-0.tar.bz2"))
self.assertTrue(MatchSpec("numpy >=1.0.1a").match("numpy-1.0.1z-0.tar.bz2"))
示例9: Resolve
print repo
r = Resolve(repo['packages'])
r.solve(env_lts['packages'], features=set())
r.solve2(env_lts['packages'], features=set())
# conda.api.fetch_repodata is the underlying index loader.
#index = get_index(channel_urls=channel_urls,
# prepend=not args.override_channels,
# use_cache=args.use_index_cache,
# unknown=args.unknown,
# json=args.json,
# offline=args.offline)
from conda.resolve import MatchSpec
fn = 'numpy-1.8.3-py27_0.tar.bz2'
ms = MatchSpec('numpy >=1.7,<1.9')
print ms.match(fn)
#for name in orig_packages:
# pkgs = sorted(r.get_pkgs(MatchSpec(name)))