autofeature自动注册zcml特性。

ftw.autofeature的Python项目详细描述


autofeature自动注册zcml特性。

附加功能

autofeature:extras指令自动为每个 额外的(extras_requires)包。 当额外项的每个依赖项 已安装。

示例

当使用这样的setup.py时:

fromsetuptoolsimportsetup,find_packagessetup(name='my.package',version='1.0.0dev0',packages=find_packages(exclude=['ez_setup']),namespace_packages=['my'],install_requires=['setuptools','ftw.autofeature',],extras_require={'tests':['unittest2'],'foo':['foo','foo-compat'],'bar':['bar','bar-compat']})

您可以让ftw.autofeature自动声明附加功能:

<configurexmlns="http://namespaces.zope.org/zope"xmlns:zcml="http://namespaces.zope.org/zcml"xmlns:autofeature="http://namespaces.zope.org/autofeature"><includepackage="ftw.autofeature"file="meta.zcml"/><autofeature:extras/><configurezcml:condition="have my.package:foo"><!-- foo things --></configure><configurezcml:condition="have my.package:bar"><!-- bar things --></configure><configurezcml:condition="have my.package:foo:bar"><!-- foo and bar things --></configure></configure>

功能my.package:foo仅在安装了附加功能时注册。 当同时安装foobar时,会注册多个功能,以便 很容易将附加功能与AND

  • my.package:foo
  • my.package:foo:bar
  • my.package:bar
  • my.package:bar:foo

限制

我们无法真正检测是否在安装时明确使用了附加功能。 因此,我们测试是否安装了extras中的每个依赖项。 当每个依赖项都已安装但未显式安装附加项时,这也将 注册功能。

转储功能

autofeature:dump指令转储当前注册的zcml功能 达到标准。 只需使用指令在zcml中的任意点转储功能:

<configurexmlns="http://namespaces.zope.org/zope"xmlns:autofeature="http://namespaces.zope.org/autofeature"><includepackage="ftw.autofeature"file="meta.zcml"/><autofeature:dump/></configure>

更改日志

1.0.0(2015-08-24)

  • 初步实施 [乔恩]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带有嵌套JAR的java RCP ClassNotFoundException   java在输入框中设置默认值,crud应用程序使用spring   java如何在Heroku中使用fs创建新文件   java将JPanel放在JFrame中   java这个正则表达式会匹配“i.imgur.com/xxx”吗?   java在片段内创建RecylerView,而无需在Android中设置片段   Android上Groovy导致java错误的双精度浮点精度损失   swing Java查找JFrame属于JPanel的内容   java Spring junit自连线自定义类本身必须有构造函数吗?   java textswitcher支持前面的文本   从Android客户端到JAXRS的java Post自定义对象   java如何检索JSON数据并使用MPAndroidChart绘制折线图,以及在安卓上的改进   拒绝用户“root”@“localhost”的java c3p0访问(使用密码“是”)   使用Selenium Webdriver自动化ExtJS应用程序时java面临的问题