hush_pyflakes = __version__
del hush_pyflakes
+def get_package_versions():
+ import OpenSSL, allmydata, foolscap, nevow, pycryptopp, setuptools, simplejson, twisted, zfec
+ return {
+ 'pyopenssl': OpenSSL.__version__,
+ 'allmydata': allmydata.__version__,
+ 'foolscap': foolscap.__version__,
+ 'nevow': nevow.__version__,
+ 'pycryptopp': pycryptopp.__version__,
+ 'setuptools': setuptools.__version__,
+ 'simplejson': simplejson.__version__,
+ 'twisted': twisted.__version__,
+ 'zfec': zfec.__version__,
+ }
+
+def get_package_versions_string():
+ versions = get_package_versions()
+ res = []
+ for p in ["allmydata", "foolscap", "pycryptopp", "zfec", "twisted", "nevow"]:
+ if versions.has_key(p):
+ res.append(str(p) + ": " + str(versions[p]))
+ del versions[p]
+ else:
+ res.append(str(p) + ": UNKNOWN")
+ for p, v in versions.iteritems():
+ res.append(str(p) + ": " + str(v))
+ return ', '.join(res)
from twisted.python import log
from foolscap import Referenceable, RemoteInterface
from foolscap.schema import DictOf, Any
+from allmydata import get_package_versions
class RILogObserver(RemoteInterface):
def msg(logmsg=DictOf(str, Any())):
#f.close()
def remote_get_versions(self):
- versions = self.parent.get_versions()
- # our __version__ attributes are actually instances of
- # allmydata.util.version_class.Version, so convert them into strings
- # first.
+ # Convert all the version instances to strings.
return dict([(k,str(v))
- for k,v in versions.items()])
+ for k,v in get_package_versions().iteritems()])
def remote_subscribe_to_all(self, observer):
s = Subscription()
from twisted.application import service
from twisted.internet import defer, reactor
from foolscap import Tub, eventual
+from allmydata import get_package_versions_string
from allmydata.util import log as tahoe_log
from allmydata.util import iputil, observer, humanreadable
from allmydata.util.assertutil import precondition
from allmydata.logpublisher import LogPublisher
-# Just to get their versions:
-import allmydata, foolscap, pycryptopp, zfec
-
# group 1 will be addr (dotted quad string), group 3 if any will be portnum (string)
ADDR_RE=re.compile("^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$")
self.log("AuthorizedKeysManhole listening on %d" % portnum)
self.setup_logging()
- self.log("Node constructed. tahoe version: %s, foolscap: %s,"
- " twisted: %s, zfec: %s"
- % (allmydata.__version__, foolscap.__version__,
- twisted.__version__, zfec.__version__,))
+ self.log("Node constructed. " + get_package_versions_string())
iputil.increase_rlimits()
def get_config(self, name, mode="r", required=False):
self.log("Unable to write config file '%s'" % fn)
self.log(e)
- def get_versions(self):
- return {'allmydata': allmydata.__version__,
- 'foolscap': foolscap.__version__,
- 'twisted': twisted.__version__,
- 'zfec': zfec.__version__,
- 'pycryptopp': pycryptopp.__version__,
- }
-
def startService(self):
# Note: this class can be started and stopped at most once.
self.log("Node.startService")
]
def opt_version(self):
- from twisted import copyright
- import allmydata, zfec, foolscap, pycryptopp
- print "Twisted version:", copyright.version
- print "Foolscap version:", foolscap.__version__
- print "zfec version:", zfec.__version__
- print "allmydata version:", allmydata.__version__
- print "pycryptopp version:", pycryptopp.__version__
+ import allmydata
+ print allmydata.get_package_versions_string()
sys.exit(0)
IMutableFileNode
from allmydata import upload, download
from allmydata import provisioning
+from allmydata import get_package_versions_string
from zope.interface import implements, Interface
import urllib
from formless import webform
child_provisioning = provisioning.ProvisioningTool()
def data_version(self, ctx, data):
- v = IClient(ctx).get_versions()
- return "tahoe: %s, zfec: %s, foolscap: %s, twisted: %s" % \
- (v['allmydata'], v['zfec'], v['foolscap'], v['twisted'])
+ return get_package_versions_string()
def data_my_nodeid(self, ctx, data):
return b32encode(IClient(ctx).nodeid).lower()