当前位置: 首页>>代码示例>>Python>>正文


Python resolve.MatchSpec类代码示例

本文整理汇总了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)
开发者ID:mdellorto,项目名称:conda,代码行数:7,代码来源:test_resolve.py

示例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)
开发者ID:mdellorto,项目名称:conda,代码行数:31,代码来源:test_resolve.py

示例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'))
开发者ID:postelrich,项目名称:conda,代码行数:30,代码来源:test_resolve.py

示例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)')
开发者ID:Korijn,项目名称:conda,代码行数:51,代码来源:test_resolve.py

示例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)
开发者ID:almarklein,项目名称:conda,代码行数:15,代码来源:test_resolve.py

示例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)
开发者ID:amfarrell,项目名称:conda,代码行数:16,代码来源:test_resolve.py

示例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)
开发者ID:pombredanne,项目名称:conda,代码行数:17,代码来源:test_resolve.py

示例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"))
开发者ID:ARF1,项目名称:conda,代码行数:43,代码来源:test_resolve.py

示例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)))

开发者ID:marqh,项目名称:conda-manifest,代码行数:29,代码来源:resolve.py


注:本文中的conda.resolve.MatchSpec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。