# but it shows a too-old version, then we'll get a
# VersionConflict error instead of DistributionNotFound.
pass
-
-def get_package_versions_from_setuptools():
- import pkg_resources
- return dict([(p.project_name, (p.version, p.location)) for p in pkg_resources.require('allmydata-tahoe')])
else:
return platform.platform()
+def get_package_versions_from_setuptools():
+ import pkg_resources
+ return dict([(p.project_name, (p.version, p.location)) for p in pkg_resources.require(__appname__)])
+
def get_package_versions_and_locations():
# because there are a few dependencies that are outside setuptools's ken
# (Python and platform, and sqlite3 if you are on Python >= 2.5), and
d1 = {
'pyOpenSSL': (OpenSSL.__version__, os.path.dirname(OpenSSL.__file__)),
- 'allmydata-tahoe': (allmydata.__version__, os.path.dirname(allmydata.__file__)),
+ __appname__: (allmydata.__version__, os.path.dirname(allmydata.__file__)),
'foolscap': (foolscap.api.__version__, os.path.dirname(foolscap.__file__)),
'Nevow': (nevow.__version__, os.path.dirname(nevow.__file__)),
'pycryptopp': (pycryptopp.__version__, os.path.dirname(pycryptopp.__file__)),
# But we prefer to get all the dependencies as known by setuptools:
import pkg_resources
try:
- d2 = _auto_deps.get_package_versions_from_setuptools()
+ d2 = get_package_versions_from_setuptools()
except pkg_resources.DistributionNotFound:
# See docstring in _auto_deps.require_auto_deps() to explain why it makes sense to ignore this exception.
pass
def get_package_versions_string(show_paths=False):
vers_and_locs = get_package_versions_and_locations()
res = []
- for p in ["allmydata-tahoe", "foolscap", "pycryptopp", "zfec", "Twisted", "Nevow", "zope.interface", "python", "platform"]:
+ for p in [__appname__, "foolscap", "pycryptopp", "zfec", "Twisted", "Nevow", "zope.interface", "python", "platform"]:
(ver, loc) = vers_and_locs.get(p, ('UNKNOWN', 'UNKNOWN'))
info = str(p) + ": " + str(ver)
if show_paths:
self.failUnless("." in str(allmydata.__full_version__),
"non-numeric version in '%s'" % allmydata.__version__)
all_versions = allmydata.get_package_versions_string()
- self.failUnless("allmydata-tahoe" in all_versions)
+ self.failUnless(allmydata.__appname__ in all_versions)
log.msg("tahoe versions: %s" % all_versions)
# also test stats
stats = c.get_stats()
out, err, rc_or_sig = res
self.failUnlessEqual(rc_or_sig, 0, str((out, err, rc_or_sig)))
- # Fail unless the allmydata-tahoe package is *this* version *and*
- # was loaded from *this* source directory.
+ # Fail unless the package is *this* version *and* was loaded from *this* source directory.
ad = os.path.dirname(os.path.dirname(os.path.realpath(allmydata.__file__)))
- required_ver_and_path = "allmydata-tahoe: %s (%s)" % (allmydata.__version__, ad)
+ required_ver_and_path = "%s: %s (%s)" % (allmydata.__appname__, allmydata.__version__, ad)
self.failUnless(out.startswith(required_ver_and_path),
(out, err, rc_or_sig, required_ver_and_path))
d.addCallback(_cb)
def _cb(res):
out, err, rc_or_sig = res
self.failUnlessEqual(rc_or_sig, 0, res)
- self.failUnless(out.startswith("allmydata-tahoe:"), res)
+ self.failUnless(out.startswith(allmydata.__appname__), res)
self.failIfIn("DeprecationWarning", out, res)
self.failUnlessEqual(err, "", res)
d.addCallback(_cb)
d = getPage(self.introweb_url, method="GET", followRedirect=True)
def _check(res):
try:
- self.failUnless("allmydata-tahoe: %s" % str(allmydata.__version__)
+ self.failUnless("%s: %s" % (allmydata.__appname__, allmydata.__version__)
in res)
self.failUnless("Announcement Summary: storage: 5, stub_client: 5" in res)
self.failUnless("Subscription Summary: storage: 5" in res)