本文整理汇总了Python中trac.util.get_pkginfo函数的典型用法代码示例。如果您正苦于以下问题:Python get_pkginfo函数的具体用法?Python get_pkginfo怎么用?Python get_pkginfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_pkginfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_pkginfo_non_toplevel
def test_get_pkginfo_non_toplevel(self):
from trac import core
import tracopt
pkginfo = util.get_pkginfo(trac)
self.assertEqual(pkginfo, util.get_pkginfo(util))
self.assertEqual(pkginfo, util.get_pkginfo(core))
self.assertEqual(pkginfo, util.get_pkginfo(tracopt))
示例2: test_get_pkginfo_babel
def test_get_pkginfo_babel(self):
try:
import babel
import babel.core
dist = pkg_resources.get_distribution('Babel')
except:
pass
else:
pkginfo = util.get_pkginfo(babel)
self.assertNotEqual({}, pkginfo)
self.assertEqual(pkginfo, util.get_pkginfo(babel.core))
示例3: test_get_pkginfo_genshi
def test_get_pkginfo_genshi(self):
try:
import genshi
import genshi.core
dist = pkg_resources.get_distribution('Genshi')
except:
pass
else:
pkginfo = util.get_pkginfo(genshi)
self.assertNotEqual({}, pkginfo)
self.assertEqual(pkginfo, util.get_pkginfo(genshi.core))
示例4: test_get_pkginfo_psycopg2
def test_get_pkginfo_psycopg2(self):
# python-psycopg2 deb package doesn't provide SOURCES.txt and
# top_level.txt
try:
import psycopg2
import psycopg2.extensions
dist = pkg_resources.get_distribution('psycopg2')
except:
pass
else:
pkginfo = util.get_pkginfo(psycopg2)
self.assertNotEqual({}, pkginfo)
self.assertEqual(pkginfo, util.get_pkginfo(psycopg2.extensions))
示例5: test_get_pkginfo_mysqldb
def test_get_pkginfo_mysqldb(self):
# MySQLdb's package name is "MySQL-Python"
try:
import MySQLdb
import MySQLdb.cursors
dist = pkg_resources.get_distribution('MySQL-Python')
dist.get_metadata('top_level.txt')
except:
pass
else:
pkginfo = util.get_pkginfo(MySQLdb)
self.assertNotEqual({}, pkginfo)
self.assertEqual(pkginfo, util.get_pkginfo(MySQLdb.cursors))
示例6: get_system_info
def get_system_info(self):
"""Yield a sequence of `(name, version)` tuples describing the name and
version information of external packages used by a component.
"""
import gdata
from trac.util import get_pkginfo
yield 'Google Data', get_pkginfo(gdata)['version']
示例7: functionalSuite
def functionalSuite(suite=None):
if not suite:
import trac.tests.functional
suite = trac.tests.functional.functionalSuite()
suite.addTest(TestWiki())
suite.addTest(TestWikiAddAttachment())
suite.addTest(TestWikiPageManipulator())
suite.addTest(TestWikiHistory())
suite.addTest(TestWikiRename())
suite.addTest(RegressionTestTicket4812())
suite.addTest(RegressionTestTicket10274())
suite.addTest(RegressionTestTicket10850())
suite.addTest(RegressionTestTicket10957())
suite.addTest(RegressionTestTicket11302())
suite.addTest(RegressionTestTicket11518())
if has_docutils:
import docutils
if get_pkginfo(docutils):
suite.addTest(ReStructuredTextWikiTest())
suite.addTest(ReStructuredTextCodeBlockTest())
else:
print "SKIP: reST wiki tests (docutils has no setuptools metadata)"
else:
print "SKIP: reST wiki tests (no docutils)"
if ConfigObj:
suite.addTest(RegressionTestTicket8976())
else:
print "SKIP: RegressionTestTicket8976 (ConfigObj not installed)"
return suite
示例8: trac_version
def trac_version(self):
"""Returns the version of Trac.
:since: 1.2
"""
from trac import core, __version__
return get_pkginfo(core).get("version", __version__)
示例9: __init__
def __init__(self):
self._mssql_version = None
self._mssql_version = has_mssql and \
get_pkginfo(pymssql).get('version',
pymssql.__version__)
if self._mssql_version:
self.required = True
self.error = None
示例10: __init__
def __init__(self):
version = get_pkginfo(pygments).get('version')
# if installed from source, fallback to the hardcoded version info
if not version and hasattr(pygments, '__version__'):
version = pygments.__version__
self.env.systeminfo.append(('Pygments',version))
self._types = None
示例11: get_system_info
def get_system_info(self):
from trac import core, __version__ as VERSION
yield 'Trac', get_pkginfo(core).get('version', VERSION)
yield 'Python', sys.version
yield 'setuptools', setuptools.__version__
from trac.util.datefmt import pytz
if pytz is not None:
yield 'pytz', pytz.__version__
示例12: get_system_info
def get_system_info(self):
# Move implementation to httpbl, ip_blacklist and url_blacklist
# when support for Trac < 1.2 is dropped (#12294).
try:
import dns
except ImportError:
pass
else:
yield 'dnspython', get_pkginfo(dns)['version']
示例13: get_connection
def get_connection(self, path, log=None, user=None, password=None,
host=None, port=None, params={}):
cnx = PostgreSQLConnection(path, log, user, password, host, port,
params)
if not self._version:
self._version = get_pkginfo(psycopg).get('version',
psycopg.__version__)
self.env.systeminfo.append(('psycopg2', self._version))
self.required = True
return cnx
示例14: __init__
def __init__(self):
self.log.debug("SilverCity installed? %r", have_silvercity)
if have_silvercity:
self.env.systeminfo.append(('SilverCity',
get_pkginfo(SilverCity).get('version',
'?')))
# TODO: the above works only if setuptools was used to build
# SilverCity, which is not yet the case by default for 0.9.7.
# I've not been able to find an alternative way to get version.
self._types = None
示例15: get_connection
def get_connection(self, path, log=None, user=None, password=None,
host=None, port=None, params={}):
cnx = PostgreSQLConnection(path, log, user, password, host, port,
params)
if not self._version:
if has_psycopg:
self._version = get_pkginfo(psycopg).get('version',
psycopg.__version__)
name = 'psycopg2'
elif has_pgsql:
import pyPgSQL
self._version = get_pkginfo(pyPgSQL).get('version',
pyPgSQL.__version__)
name = 'pyPgSQL'
else:
name = 'unknown postgreSQL driver'
self._version = '?'
self.env.systeminfo.append((name, self._version))
return cnx