mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-20 03:36:25 +00:00
setup: replace hardcoded 'allmydata-tahoe' with allmydata.__appname__
This commit is contained in:
parent
43fe346d71
commit
44edecb36c
@ -107,7 +107,3 @@ def require_auto_deps():
|
||||
# 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')])
|
||||
|
@ -165,6 +165,10 @@ def get_platform():
|
||||
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
|
||||
@ -192,7 +196,7 @@ def get_package_versions_and_locations():
|
||||
|
||||
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__)),
|
||||
@ -210,7 +214,7 @@ def get_package_versions_and_locations():
|
||||
# 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
|
||||
@ -228,7 +232,7 @@ def get_package_locations():
|
||||
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:
|
||||
|
@ -160,7 +160,7 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase):
|
||||
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()
|
||||
|
@ -39,10 +39,9 @@ class BinTahoe(common_util.SignalMixin, unittest.TestCase, SkipMixin):
|
||||
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)
|
||||
@ -60,7 +59,7 @@ class BinTahoe(common_util.SignalMixin, unittest.TestCase, SkipMixin):
|
||||
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)
|
||||
|
@ -750,7 +750,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user