It is currently hardcoded in setup.py to be 'allmydata-tahoe'. Ticket #556 is to make it configurable by a runtime command-line argument to setup.py: "--appname=foo", but I suddenly wondered if we really wanted that and at the same time realized that we don't need that for tahoe-1.3.0 release, so this patch just hardcodes it in setup.py.
setup.py inspects a file named 'src/allmydata/_appname.py' and assert that it contains the string "__appname__ = 'allmydata-tahoe'", and creates it if it isn't already present. src/allmydata/__init__.py import _appname and reads __appname__ from it. The rest of the Python code imports allmydata and inspects "allmydata.__appname__", although actually every use it uses "allmydata.__full_version__" instead, where "allmydata.__full_version__" is created in src/allmydata/__init__.py to be:
__full_version__ = __appname + '-' + str(__version__).
All the code that emits an "application version string" when describing what version of a protocol it supports (introducer server, storage server, upload helper), or when describing itself in general (introducer client), usese allmydata.__full_version__.
This fixes ticket #556 at least well enough for tahoe-1.3.0 release.
# _auto_deps.install_requires list, which is used in the call to setup() below.
from _auto_deps import install_requires
-setup(name='allmydata-tahoe',
+APPNAME='allmydata-tahoe'
+APPNAMEFILE = os.path.join('src', 'allmydata', '_appname.py')
+APPNAMEFILESTR = "__appname__ = '%s'" % (APPNAME,)
+try:
+ curappnamefilestr = open(APPNAMEFILE, 'rU').read()
+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:
+ 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)
+
+setup(name=APPNAME,
description='secure, decentralized, fault-tolerant filesystem',
long_description=LONG_DESCRIPTION,
author='the allmydata.org Tahoe project',
# not happen very often.
pass
+__appname__ = "unknown"
+try:
+ from _appname import __appname__
+except ImportError:
+ # We're running in a tree that hasn't run "./setup.py". This shouldn't happen.
+ pass
+
+# __full_version__ is the one that you ought to use when identifying yourself in the
+# "application" part of the Tahoe versioning scheme:
+# http://allmydata.org/trac/tahoe/wiki/Versioning
+__full_version__ = __appname__ + '-' + str(__version__)
+
hush_pyflakes = __version__
del hush_pyflakes
self.introducer_furl = self.get_config("client", "introducer.furl")
ic = IntroducerClient(self.tub, self.introducer_furl,
self.nickname,
- str(allmydata.__version__),
+ str(allmydata.__full_version__),
str(self.OLDEST_SUPPORTED_VERSION))
self.introducer_client = ic
# hold off on starting the IntroducerClient until our tub has been
from twisted.internet import defer
from foolscap import Referenceable, DeadReferenceError
from foolscap.eventual import eventually
-import allmydata
+import allmydata # for __full_version__
from allmydata import interfaces, storage, uri
from allmydata.immutable import upload
from allmydata.immutable.layout import ReadBucketProxy
implements(interfaces.RICHKUploadHelper)
VERSION = { "http://allmydata.org/tahoe/protocols/helper/chk-upload/v1" :
{ },
- "application-version": str(allmydata.__version__),
+ "application-version": str(allmydata.__full_version__),
}
def __init__(self, storage_index, helper,
name = "helper"
VERSION = { "http://allmydata.org/tahoe/protocols/helper/v1" :
{ },
- "application-version": str(allmydata.__version__),
+ "application-version": str(allmydata.__full_version__),
}
chk_upload_helper_class = CHKUploadHelper
MAX_UPLOAD_STATUSES = 10
name = "introducer"
VERSION = { "http://allmydata.org/tahoe/protocols/introducer/v1":
{ },
- "application-version": str(allmydata.__version__),
+ "application-version": str(allmydata.__full_version__),
}
def __init__(self, basedir="."):
from cStringIO import StringIO
import urlparse, httplib
-import allmydata # for __version__
+import allmydata # for __full_version__
# copied from twisted/web/client.py
def parse_url(url, defaultPort=None):
raise ValueError("unknown scheme '%s', need http or https" % scheme)
c.putrequest(method, path)
c.putheader("Hostname", host)
- c.putheader("User-Agent", "tahoe_cli/%s" % allmydata.__version__)
+ c.putheader("User-Agent", "tahoe_cli/%s" % allmydata.__full_version__)
c.putheader("Connection", "close")
old = body.tell()
RIBucketReader, BadWriteEnablerError, IStatsProducer
from allmydata.util import base32, fileutil, idlib, log, time_format
from allmydata.util.assertutil import precondition
-import allmydata # for __version__
+import allmydata # for __full_version__
class DataTooLargeError(Exception):
pass
"tolerates-immutable-read-overrun": True,
"delete-mutable-shares-with-zero-length-writev": True,
},
- "application-version": str(allmydata.__version__),
+ "application-version": str(allmydata.__full_version__),
}
return version
ss = c.getServiceNamed("storage")
verdict = ss.remote_get_version()
self.failUnlessEqual(verdict["application-version"],
- str(allmydata.__version__))
+ str(allmydata.__full_version__))
self.failIfEqual(str(allmydata.__version__), "unknown")
- self.failUnless("." in str(allmydata.__version__),
+ self.failUnless("." in str(allmydata.__full_version__),
"non-numeric version in '%s'" % allmydata.__version__)
all_versions = allmydata.get_package_versions_string()
- self.failUnless("allmydata" in all_versions)
+ self.failUnless("allmydata-tahoe" in all_versions)
log.msg("tahoe versions: %s" % all_versions)
# also test stats
stats = c.get_stats()
from twisted.internet import defer
from foolscap import eventual
-import allmydata
+import allmydata # for __full_version__
from allmydata import uri, monitor
from allmydata.immutable import upload
from allmydata.interfaces import IFileURI, FileTooLargeError, NotEnoughSharesError
self.queries = 0
self.version = { "http://allmydata.org/tahoe/protocols/storage/v1" :
{ "maximum-immutable-share-size": 2**32 },
- "application-version": str(allmydata.__version__),
+ "application-version": str(allmydata.__full_version__),
}
if mode == "small":
self.version = { "http://allmydata.org/tahoe/protocols/storage/v1" :
{ "maximum-immutable-share-size": 10 },
- "application-version": str(allmydata.__version__),
+ "application-version": str(allmydata.__full_version__),
}