當前位置: 首頁>>代碼示例>>Python>>正文


Python depends.Require方法代碼示例

本文整理匯總了Python中setuptools.depends.Require方法的典型用法代碼示例。如果您正苦於以下問題:Python depends.Require方法的具體用法?Python depends.Require怎麽用?Python depends.Require使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在setuptools.depends的用法示例。


在下文中一共展示了depends.Require方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from setuptools import depends [as 別名]
# 或者: from setuptools.depends import Require [as 別名]
def setUp(self):
        self.req = Require('Distutils','1.0.3','distutils')
        self.dist = makeSetup(
            features={
                'foo': Feature("foo",standard=True,require_features=['baz',self.req]),
                'bar': Feature("bar",  standard=True, packages=['pkg.bar'],
                               py_modules=['bar_et'], remove=['bar.ext'],
                       ),
                'baz': Feature(
                        "baz", optional=False, packages=['pkg.baz'],
                        scripts = ['scripts/baz_it'],
                        libraries=[('libfoo','foo/foofoo.c')]
                       ),
                'dwim': Feature("DWIM", available=False, remove='bazish'),
            },
            script_args=['--without-bar', 'install'],
            packages = ['pkg.bar', 'pkg.foo'],
            py_modules = ['bar_et', 'bazish'],
            ext_modules = [Extension('bar.ext',['bar.c'])]
        ) 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:22,代碼來源:__init__.py

示例2: __init__

# 需要導入模塊: from setuptools import depends [as 別名]
# 或者: from setuptools.depends import Require [as 別名]
def __init__(self, description, standard=False, available=True,
            optional=True, require_features=(), remove=(), **extras):
        self.warn_deprecated()

        self.description = description
        self.standard = standard
        self.available = available
        self.optional = optional
        if isinstance(require_features,(str,Require)):
            require_features = require_features,

        self.require_features = [
            r for r in require_features if isinstance(r,str)
        ]
        er = [r for r in require_features if not isinstance(r,str)]
        if er: extras['require_features'] = er

        if isinstance(remove,str):
            remove = remove,
        self.remove = remove
        self.extras = extras

        if not remove and not require_features and not extras:
            raise DistutilsSetupError(
                "Feature %s: must define 'require_features', 'remove', or at least one"
                " of 'packages', 'py_modules', etc."
            ) 
開發者ID:jpush,項目名稱:jbox,代碼行數:29,代碼來源:dist.py

示例3: __init__

# 需要導入模塊: from setuptools import depends [as 別名]
# 或者: from setuptools.depends import Require [as 別名]
def __init__(self, description, standard=False, available=True,
            optional=True, require_features=(), remove=(), **extras):
        self.warn_deprecated()

        self.description = description
        self.standard = standard
        self.available = available
        self.optional = optional
        if isinstance(require_features, (str, Require)):
            require_features = require_features,

        self.require_features = [
            r for r in require_features if isinstance(r, str)
        ]
        er = [r for r in require_features if not isinstance(r, str)]
        if er:
            extras['require_features'] = er

        if isinstance(remove, str):
            remove = remove,
        self.remove = remove
        self.extras = extras

        if not remove and not require_features and not extras:
            raise DistutilsSetupError(
                "Feature %s: must define 'require_features', 'remove', or at least one"
                " of 'packages', 'py_modules', etc."
            ) 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:30,代碼來源:dist.py

示例4: testRequire

# 需要導入模塊: from setuptools import depends [as 別名]
# 或者: from setuptools.depends import Require [as 別名]
def testRequire(self):
        if not hasattr(dep, 'extract_constant'):
            # skip on non-bytecode platformsh
            return

        req = Require('Email','1.0.3','email')

        self.assertEqual(req.name, 'Email')
        self.assertEqual(req.module, 'email')
        self.assertEqual(req.requested_version, '1.0.3')
        self.assertEqual(req.attribute, '__version__')
        self.assertEqual(req.full_name(), 'Email-1.0.3')

        from email import __version__
        self.assertEqual(req.get_version(), __version__)
        self.assertTrue(req.version_ok('1.0.9'))
        self.assertTrue(not req.version_ok('0.9.1'))
        self.assertTrue(not req.version_ok('unknown'))

        self.assertTrue(req.is_present())
        self.assertTrue(req.is_current())

        req = Require('Email 3000','03000','email',format=LooseVersion)
        self.assertTrue(req.is_present())
        self.assertTrue(not req.is_current())
        self.assertTrue(not req.version_ok('unknown'))

        req = Require('Do-what-I-mean','1.0','d-w-i-m')
        self.assertTrue(not req.is_present())
        self.assertTrue(not req.is_current())

        req = Require('Tests', None, 'tests', homepage="http://example.com")
        self.assertEqual(req.format, None)
        self.assertEqual(req.attribute, None)
        self.assertEqual(req.requested_version, None)
        self.assertEqual(req.full_name(), 'Tests')
        self.assertEqual(req.homepage, 'http://example.com')

        paths = [os.path.dirname(p) for p in __path__]
        self.assertTrue(req.is_present(paths))
        self.assertTrue(req.is_current(paths)) 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:43,代碼來源:__init__.py

示例5: __init__

# 需要導入模塊: from setuptools import depends [as 別名]
# 或者: from setuptools.depends import Require [as 別名]
def __init__(
            self, description, standard=False, available=True,
            optional=True, require_features=(), remove=(), **extras):
        self.warn_deprecated()

        self.description = description
        self.standard = standard
        self.available = available
        self.optional = optional
        if isinstance(require_features, (str, Require)):
            require_features = require_features,

        self.require_features = [
            r for r in require_features if isinstance(r, str)
        ]
        er = [r for r in require_features if not isinstance(r, str)]
        if er:
            extras['require_features'] = er

        if isinstance(remove, str):
            remove = remove,
        self.remove = remove
        self.extras = extras

        if not remove and not require_features and not extras:
            raise DistutilsSetupError(
                "Feature %s: must define 'require_features', 'remove', or "
                "at least one of 'packages', 'py_modules', etc."
            ) 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:31,代碼來源:dist.py

示例6: testRequire

# 需要導入模塊: from setuptools import depends [as 別名]
# 或者: from setuptools.depends import Require [as 別名]
def testRequire(self):
        req = Require('Json', '1.0.3', 'json')

        assert req.name == 'Json'
        assert req.module == 'json'
        assert req.requested_version == '1.0.3'
        assert req.attribute == '__version__'
        assert req.full_name() == 'Json-1.0.3'

        from json import __version__
        assert req.get_version() == __version__
        assert req.version_ok('1.0.9')
        assert not req.version_ok('0.9.1')
        assert not req.version_ok('unknown')

        assert req.is_present()
        assert req.is_current()

        req = Require('Json 3000', '03000', 'json', format=LooseVersion)
        assert req.is_present()
        assert not req.is_current()
        assert not req.version_ok('unknown')

        req = Require('Do-what-I-mean', '1.0', 'd-w-i-m')
        assert not req.is_present()
        assert not req.is_current() 
開發者ID:pypa,項目名稱:setuptools,代碼行數:28,代碼來源:test_setuptools.py


注:本文中的setuptools.depends.Require方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。