setup: replace hardcoded 'allmydata-tahoe' with allmydata.__appname__
authorZooko O'Whielacronx <zooko@zooko.com>
Sun, 1 Aug 2010 16:05:17 +0000 (09:05 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Sun, 1 Aug 2010 16:05:17 +0000 (09:05 -0700)
_auto_deps.py
src/allmydata/__init__.py
src/allmydata/test/test_client.py
src/allmydata/test/test_runner.py
src/allmydata/test/test_system.py

index d6bf6a4d2856bedd88498907e0654f2989fcbca7..c55c9aed017a5f1436d598c1dbb82a5b1950f043 100644 (file)
@@ -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')])
index 0b5d6129341862a07cbe27bdd5885221fddf00ab..97fa15c6c2809a49a25c00af862b7f1829305d65 100644 (file)
@@ -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:
index e2e80d8941b7e8f970d24d8bf6215ae91b12c8b7..59a37f9883dc99edabc7b4e74ffe13d863790292 100644 (file)
@@ -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()
index 5ff10ba7cb7f6e9bd3297af0d46830f58c2a8ce0..53571a6289205600b073e7ddf75802de05699f03 100644 (file)
@@ -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)
index 3351102c5c16474cfdf2d7dc2b90100f0ab2982f..9c285799649a6493f4a43c063de351b8ffb50301 100644 (file)
@@ -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)