]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - src/allmydata/__init__.py
setup: require specific versions of dependencies, both at run-time (if pkg_resources...
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / __init__.py
1
2 """
3 Decentralized storage grid.
4
5 maintainer web site: U{http://allmydata.com/}
6
7 community web site: U{http://allmydata.org/}
8 """
9
10 __version__ = "unknown"
11 try:
12     from _version import __version__
13 except ImportError:
14     # We're running in a tree that hasn't run "./setup.py darcsver", and didn't
15     # come with a _version.py, so we don't know what our version is. This should
16     # not happen very often.
17     pass
18
19 hush_pyflakes = __version__
20 del hush_pyflakes
21
22 try:
23     import _auto_deps
24 except ImportError:
25     # Never mind -- even if we can't use pkg_resources to check the required
26     # version numbers and to select the right one in the case that more than one
27     # version is available, we can still barrel on and if "import thingie" gives
28     # us a thingie that works, we're okay.
29     pass
30 else:
31     _auto_deps.require_auto_deps()
32
33 def get_package_versions():
34     import OpenSSL, allmydata, foolscap, nevow, pycryptopp, simplejson, twisted, zfec
35     setuptools_version = "unavailable"
36     try:
37         import setuptools
38         setuptools_version = setuptools.__version__
39     except ImportError:
40         pass
41     return {
42         'pyopenssl': OpenSSL.__version__,
43         'allmydata': allmydata.__version__,
44         'foolscap': foolscap.__version__,
45         'nevow': nevow.__version__,
46         'pycryptopp': pycryptopp.__version__,
47         'setuptools': setuptools_version,
48         'simplejson': simplejson.__version__,
49         'twisted': twisted.__version__,
50         'zfec': zfec.__version__,
51         }
52
53 def get_package_versions_string():
54     versions = get_package_versions()
55     res = []
56     for p in ["allmydata", "foolscap", "pycryptopp", "zfec", "twisted", "nevow"]:
57         if versions.has_key(p):
58             res.append(str(p) + ": " + str(versions[p]))
59             del versions[p]
60         else:
61             res.append(str(p) + ": UNKNOWN")
62     for p, v in versions.iteritems():
63         res.append(str(p) + ": " + str(v))
64     return ', '.join(res)