From 52d45b81bd5f3539263abf463c3b97e930bfa061 Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Sat, 6 Dec 2014 05:37:57 +0000
Subject: [PATCH] Change appname from "allmydata-tahoe" to "tahoe-lafs". fixes
 #2011

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 Makefile                                  | 2 +-
 docs/how_to_make_a_tahoe-lafs_release.org | 6 +++---
 docs/quickstart.rst                       | 2 +-
 setup.py                                  | 9 ++++++---
 src/allmydata/test/test_version.py        | 2 +-
 src/allmydata/test/test_web.py            | 2 +-
 6 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index a8afc1bd..b5775f96 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ export PYTHON
 
 TAHOE=$(PYTHON) bin/tahoe
 SOURCES=src/allmydata src/buildtest static misc bin/tahoe-script.template setup.py
-APPNAME=allmydata-tahoe
+APPNAME=tahoe-lafs
 
 # This is necessary only if you want to automatically produce a new
 # _version.py file from the current git history (without doing a build).
diff --git a/docs/how_to_make_a_tahoe-lafs_release.org b/docs/how_to_make_a_tahoe-lafs_release.org
index b7181bd5..8c063146 100644
--- a/docs/how_to_make_a_tahoe-lafs_release.org
+++ b/docs/how_to_make_a_tahoe-lafs_release.org
@@ -6,10 +6,10 @@
     - CREDITS
     - docs/known_issues.rst
   - [ ] change docs/quickstart.rst to point to just the current
-    allmydata-tahoe-X.Y.Z.zip source code file, or else to point to a
-    directory which contains only allmydata-tahoe-X.Y.Z.* source code files
+    tahoe-lafs-X.Y.Z.zip source code file, or else to point to a
+    directory which contains only tahoe-lafs-X.Y.Z.* source code files
   - [ ] git pull
-  - [ ] git tag allmydata-tahoe-X.Y.Z
+  - [ ] git tag tahoe-lafs-X.Y.Z
   - [ ] build locally to make sure the release is reporting itself as the
     intended version
   - [ ] make sure buildbot is green
diff --git a/docs/quickstart.rst b/docs/quickstart.rst
index e0395062..5d8dcc17 100644
--- a/docs/quickstart.rst
+++ b/docs/quickstart.rst
@@ -63,7 +63,7 @@ first time you set up Tahoe-LAFS on a particular installation of Windows.
 
 Run "``bin/tahoe --version``" (on Windows, "``bin\tahoe --version``") to
 verify that the executable tool prints out the right version number after
-"``allmydata-tahoe:``".
+"``allmydata-tahoe:``" or "``tahoe-lafs:``".
 
 Optionally run "``python setup.py trial``" to verify that it passes all of
 its self-tests.
diff --git a/setup.py b/setup.py
index 0693e634..4ffd0f01 100644
--- a/setup.py
+++ b/setup.py
@@ -40,16 +40,19 @@ def read_version_py(infname):
 VERSION_PY_FILENAME = 'src/allmydata/_version.py'
 version = read_version_py(VERSION_PY_FILENAME)
 
-APPNAME='allmydata-tahoe'
+APPNAME='tahoe-lafs'
 APPNAMEFILE = os.path.join('src', 'allmydata', '_appname.py')
 APPNAMEFILESTR = "__appname__ = '%s'" % (APPNAME,)
 try:
-    curappnamefilestr = open(APPNAMEFILE, 'rU').read()
+    curappnamefilestr = open(APPNAMEFILE, 'rU').read().strip()
 except EnvironmentError:
     # No file, or unreadable or something, okay then let's try to write one.
     open(APPNAMEFILE, "w").write(APPNAMEFILESTR)
 else:
-    if curappnamefilestr.strip() != APPNAMEFILESTR:
+    if "allmydata-tahoe" in curappnamefilestr:
+        # This is harmless, just overwrite it.
+        open(APPNAMEFILE, "w").write(APPNAMEFILESTR)
+    elif curappnamefilestr != APPNAMEFILESTR:
         print("Error -- this setup.py file is configured with the 'application name' to be '%s', but there is already a file in place in '%s' which contains the contents '%s'.  If the file is wrong, please remove it and setup.py will regenerate it and write '%s' into it." % (APPNAME, APPNAMEFILE, curappnamefilestr, APPNAMEFILESTR))
         sys.exit(-1)
 
diff --git a/src/allmydata/test/test_version.py b/src/allmydata/test/test_version.py
index 296db062..2510462f 100644
--- a/src/allmydata/test/test_version.py
+++ b/src/allmydata/test/test_version.py
@@ -58,7 +58,7 @@ class CheckRequirement(unittest.TestCase):
         res = cross_check({}, [])
         self.failUnlessEqual(res, [])
 
-        res = cross_check({}, [("allmydata-tahoe", ("1.0", "", "blah"))])
+        res = cross_check({}, [("tahoe-lafs", ("1.0", "", "blah"))])
         self.failUnlessEqual(res, [])
 
         res = cross_check({"foo": ("unparseable", "")}, [])
diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py
index 8c5ead4b..0da90c25 100644
--- a/src/allmydata/test/test_web.py
+++ b/src/allmydata/test/test_web.py
@@ -174,7 +174,7 @@ class FakeHistory:
 class FakeDisplayableServer(StubServer):
     def __init__(self, serverid, nickname):
         StubServer.__init__(self, serverid)
-        self.announcement = {"my-version": "allmydata-tahoe-fake",
+        self.announcement = {"my-version": "tahoe-lafs-fake",
                              "service-name": "storage",
                              "nickname": nickname}
     def is_connected(self):
-- 
2.45.2