Changeset c694e8c in trunk
- Timestamp:
- 2020-11-23T20:10:18Z (5 years ago)
- Branches:
- master
- Children:
- d03dece
- Parents:
- 224085c
- Location:
- src/allmydata
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/client.py ¶
r224085c rc694e8c 513 513 str(allmydata.__full_version__), 514 514 str(_Client.OLDEST_SUPPORTED_VERSION), 515 list(node.get_app_versions()),516 515 partial(_sequencer, config), 517 516 introducer_cache_filepath, -
TabularUnified src/allmydata/introducer/client.py ¶
r224085c rc694e8c 25 25 def __init__(self, tub, introducer_furl, 26 26 nickname, my_version, oldest_supported, 27 app_versions,sequencer, cache_filepath):27 sequencer, cache_filepath): 28 28 self._tub = tub 29 29 self.introducer_furl = introducer_furl … … 33 33 self._my_version = my_version 34 34 self._oldest_supported = oldest_supported 35 self._app_versions = app_versions36 35 self._sequencer = sequencer 37 36 self._cache_filepath = cache_filepath … … 39 38 self._my_subscriber_info = { "version": 0, 40 39 "nickname": self._nickname, 41 "app-versions": self._app_versions,40 "app-versions": [], 42 41 "my-version": self._my_version, 43 42 "oldest-supported": self._oldest_supported, … … 191 190 # publish(), each time we make a change 192 191 "nickname": self._nickname, 193 "app-versions": self._app_versions,192 "app-versions": [], 194 193 "my-version": self._my_version, 195 194 "oldest-supported": self._oldest_supported, -
TabularUnified src/allmydata/node.py ¶
r224085c rc694e8c 29 29 from twisted.application import service 30 30 from twisted.python.failure import Failure 31 from foolscap.api import Tub, app_versions 31 from foolscap.api import Tub 32 32 33 import foolscap.logging.log 33 from allmydata.version_checks import get_package_versions, get_package_versions_string 34 34 35 from allmydata.util import log 35 36 from allmydata.util import fileutil, iputil … … 38 39 from allmydata.util.encodingutil import get_filesystem_encoding, quote_output 39 40 from allmydata.util import configutil 41 42 from . import ( 43 __full_version__, 44 ) 40 45 41 46 def _common_valid_config(): … … 79 84 }) 80 85 81 # Add our application versions to the data that Foolscap's LogPublisher82 # reports. Foolscap requires native strings.83 for thing, things_version in list(get_package_versions().items()):84 app_versions.add_version(85 ensure_str(thing),86 None if things_version is None else ensure_str(things_version),87 )88 89 86 # group 1 will be addr (dotted quad string), group 3 if any will be portnum (string) 90 87 ADDR_RE = re.compile("^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$") … … 230 227 configutil.validate_config(fname, parser, _valid_config) 231 228 return _Config(parser, portnumfile, basedir, fname) 232 233 234 def get_app_versions():235 """236 :returns: dict of versions important to Foolscap237 """238 return dict(app_versions.versions)239 229 240 230 … … 763 753 self.control_tub.setServiceParent(self) 764 754 765 self.log("Node constructed. " + get_package_versions_string())755 self.log("Node constructed. " + __full_version__) 766 756 iputil.increase_rlimits() 767 757 -
TabularUnified src/allmydata/scripts/runner.py ¶
r224085c rc694e8c 8 8 from twisted.internet import defer, task, threads 9 9 10 from allmydata.version_checks import get_package_versions_string11 10 from allmydata.scripts.common import get_default_nodedir 12 11 from allmydata.scripts import debug, create_node, cli, \ … … 20 19 ) 21 20 21 from .. import ( 22 __full_version__, 23 ) 24 22 25 _default_nodedir = get_default_nodedir() 23 26 … … 78 81 79 82 def opt_version(self): 80 print( get_package_versions_string(debug=True), file=self.stdout)83 print(__full_version__, file=self.stdout) 81 84 self.no_command_needed = True 82 85 83 def opt_version_and_path(self): 84 print(get_package_versions_string(show_paths=True, debug=True), file=self.stdout) 85 self.no_command_needed = True 86 opt_version_and_path = opt_version 86 87 87 88 opt_eliot_destination = opt_eliot_destination -
TabularUnified src/allmydata/test/cli/test_cli.py ¶
r224085c rc694e8c 1267 1267 stdout = StringIO() 1268 1268 self.failUnlessRaises(SystemExit, self.parse, ["--version"], stdout) 1269 self.failUnlessIn(allmydata.__ appname__ + ":", stdout.getvalue())1269 self.failUnlessIn(allmydata.__full_version__, stdout.getvalue()) 1270 1270 # but "tahoe SUBCOMMAND --version" should be rejected 1271 1271 self.failUnlessRaises(usage.UsageError, self.parse, -
TabularUnified src/allmydata/test/common.py ¶
r224085c rc694e8c 111 111 my_version = attr.ib() 112 112 oldest_supported = attr.ib() 113 app_versions = attr.ib()114 113 sequencer = attr.ib() 115 114 cache_filepath = attr.ib() -
TabularUnified src/allmydata/test/test_client.py ¶
r224085c rc694e8c 42 42 from allmydata.node import OldConfigError, UnescapedHashError, create_node_dir 43 43 from allmydata.frontends.auth import NeedRootcapLookupScheme 44 from allmydata.version_checks import (45 get_package_versions_string,46 )47 44 from allmydata import client 48 45 from allmydata.storage_client import ( … … 622 619 self.failUnless("." in str(allmydata.__full_version__), 623 620 "non-numeric version in '%s'" % allmydata.__version__) 624 all_versions = get_package_versions_string()625 self.failUnless(allmydata.__appname__ in all_versions)626 621 # also test stats 627 622 stats = c.get_stats() -
TabularUnified src/allmydata/test/test_introducer.py ¶
r224085c rc694e8c 156 156 def test_create(self): 157 157 ic = IntroducerClient(None, "introducer.furl", u"my_nickname", 158 "my_version", "oldest_version", {},fakeseq,158 "my_version", "oldest_version", fakeseq, 159 159 FilePath(self.mktemp())) 160 160 self.failUnless(isinstance(ic, IntroducerClient)) … … 189 189 ic1 = IntroducerClient(None, 190 190 "introducer.furl", u"my_nickname", 191 "ver23", "oldest_version", {},fakeseq,191 "ver23", "oldest_version", fakeseq, 192 192 FilePath(self.mktemp())) 193 193 # we use a second client just to create a different-looking … … 195 195 ic2 = IntroducerClient(None, 196 196 "introducer.furl", u"my_nickname", 197 "ver24","oldest_version", {},fakeseq,197 "ver24","oldest_version",fakeseq, 198 198 FilePath(self.mktemp())) 199 199 announcements = [] … … 299 299 ic1 = IntroducerClient(None, 300 300 "introducer.furl", u"my_nickname", 301 "ver23", "oldest_version", {},realseq,301 "ver23", "oldest_version", realseq, 302 302 FilePath(self.mktemp())) 303 303 furl1 = "pb://62ubehyunnyhzs7r6vdonnm2hpi52w6y@127.0.0.1:36106/gydnp" … … 397 397 tub2.setServiceParent(self.parent) 398 398 c = IntroducerClient(tub2, ifurl, 399 u"nickname", "version", "oldest", {},fakeseq,399 u"nickname", "version", "oldest", fakeseq, 400 400 FilePath(self.mktemp())) 401 401 furl1 = "pb://onug64tu@127.0.0.1:123/short" # base32("short") … … 478 478 NICKNAME % str(i), 479 479 "version", "oldest", 480 {"component": "component-v1"},fakeseq,480 fakeseq, 481 481 FilePath(self.mktemp())) 482 482 received_announcements[c] = {} … … 738 738 introducer = IntroducerService() 739 739 tub = introducer_furl = None 740 app_versions = {"whizzy": "fizzy"}741 740 client_v2 = IntroducerClient(tub, introducer_furl, NICKNAME % u"v2", 742 "my_version", "oldest", app_versions,741 "my_version", "oldest", 743 742 fakeseq, FilePath(self.mktemp())) 744 743 #furl1 = "pb://62ubehyunnyhzs7r6vdonnm2hpi52w6y@127.0.0.1:0/swissnum" … … 752 751 s0 = subs[0] 753 752 self.failUnlessEqual(s0.service_name, "storage") 754 self.failUnlessEqual(s0.app_versions, app_versions)755 753 self.failUnlessEqual(s0.nickname, NICKNAME % u"v2") 756 754 self.failUnlessEqual(s0.version, "my_version") … … 761 759 introducer = IntroducerService() 762 760 tub = introducer_furl = None 763 app_versions = {"whizzy": "fizzy"}764 761 client_v2 = IntroducerClient(tub, introducer_furl, u"nick-v2", 765 "my_version", "oldest", app_versions,762 "my_version", "oldest", 766 763 fakeseq, FilePath(self.mktemp())) 767 764 furl1 = "pb://62ubehyunnyhzs7r6vdonnm2hpi52w6y@127.0.0.1:0/swissnum" … … 777 774 self.assertThat(a[0].canary, Is(canary0)) 778 775 self.failUnlessEqual(a[0].index, ("storage", public_key_str)) 779 self.failUnlessEqual(a[0].announcement["app-versions"], app_versions)780 776 self.failUnlessEqual(a[0].nickname, u"nick-v2") 781 777 self.failUnlessEqual(a[0].service_name, "storage") … … 855 851 yield flushEventualQueue() 856 852 ic2 = IntroducerClient(None, "introducer.furl", u"my_nickname", 857 "my_version", "oldest_version", {},fakeseq,853 "my_version", "oldest_version", fakeseq, 858 854 ic._cache_filepath) 859 855 announcements = {} … … 955 951 listenOnUnused(tub) 956 952 c = IntroducerClient(tub, self.introducer_furl, 957 u"nickname-client", "version", "oldest", {},953 u"nickname-client", "version", "oldest", 958 954 fakeseq, FilePath(self.mktemp())) 959 955 announcements = {} … … 1028 1024 "0.0.0", 1029 1025 "1.2.3", 1030 {},1031 1026 (0, u"i am a nonce"), 1032 1027 "invalid", -
TabularUnified src/allmydata/test/test_node.py ¶
r224085c rc694e8c 47 47 formatTimeTahoeStyle, 48 48 UnescapedHashError, 49 get_app_versions,50 49 ) 51 50 from allmydata.introducer.server import create_introducer … … 101 100 # conflict with another service to prove it. 102 101 self._available_port = 22 103 104 def test_application_versions(self):105 """106 Application versions should all have the same type, the native string.107 108 This test is due to the Foolscap limitations, if Foolscap is fixed or109 removed it can be deleted.110 """111 app_types = set(type(o) for o in get_app_versions())112 self.assertEqual(app_types, {native_str})113 102 114 103 def _test_location( -
TabularUnified src/allmydata/test/test_runner.py ¶
r224085c rc694e8c 13 13 from twisted.internet.defer import ( 14 14 inlineCallbacks, 15 returnValue,16 15 DeferredList, 17 16 ) … … 21 20 ) 22 21 from allmydata.util import fileutil, pollmixin 23 from allmydata.util.encodingutil import unicode_to_argv, unicode_to_output, \ 24 get_filesystem_encoding 22 from allmydata.util.encodingutil import unicode_to_argv, unicode_to_output 25 23 from allmydata.test import common_util 26 from allmydata.version_checks import normalized_version27 24 import allmydata 28 from allmydata import __appname__29 25 from .common_util import parse_cli, run_cli 30 26 from .cli_node_api import ( … … 59 55 60 56 class RunBinTahoeMixin(object): 61 62 @inlineCallbacks63 def find_import_location(self):64 res = yield self.run_bintahoe(["--version-and-path"])65 out, err, rc_or_sig = res66 self.assertEqual(rc_or_sig, 0, res)67 lines = out.splitlines()68 tahoe_pieces = lines[0].split()69 self.assertEqual(tahoe_pieces[0], "%s:" % (__appname__,), (tahoe_pieces, res))70 returnValue(tahoe_pieces[-1].strip("()"))71 72 57 def run_bintahoe(self, args, stdin=None, python_options=[], env=None): 73 58 command = sys.executable … … 87 72 88 73 class BinTahoe(common_util.SignalMixin, unittest.TestCase, RunBinTahoeMixin): 89 @inlineCallbacks90 def test_the_right_code(self):91 # running "tahoe" in a subprocess should find the same code that92 # holds this test file, else something is weird93 test_path = os.path.dirname(os.path.dirname(os.path.normcase(os.path.realpath(srcfile))))94 bintahoe_import_path = yield self.find_import_location()95 96 same = (bintahoe_import_path == test_path)97 if not same:98 msg = ("My tests and my 'tahoe' executable are using different paths.\n"99 "tahoe: %r\n"100 "tests: %r\n"101 "( according to the test source filename %r)\n" %102 (bintahoe_import_path, test_path, srcfile))103 104 if (not isinstance(rootdir, unicode) and105 rootdir.decode(get_filesystem_encoding(), 'replace') != rootdir):106 msg += ("However, this may be a false alarm because the import path\n"107 "is not representable in the filesystem encoding.")108 raise unittest.SkipTest(msg)109 else:110 msg += "Please run the tests in a virtualenv that includes both the Tahoe-LAFS library and the 'tahoe' executable."111 self.fail(msg)112 113 def test_path(self):114 d = self.run_bintahoe(["--version-and-path"])115 def _cb(res):116 out, err, rc_or_sig = res117 self.failUnlessEqual(rc_or_sig, 0, str(res))118 119 # Fail unless the __appname__ package is *this* version *and*120 # was loaded from *this* source directory.121 122 required_verstr = str(allmydata.__version__)123 124 self.failIfEqual(required_verstr, "unknown",125 "We don't know our version, because this distribution didn't come "126 "with a _version.py and 'setup.py update_version' hasn't been run.")127 128 srcdir = os.path.dirname(os.path.dirname(os.path.normcase(os.path.realpath(srcfile))))129 info = repr((res, allmydata.__appname__, required_verstr, srcdir))130 131 appverpath = out.split(')')[0]132 (appverfull, path) = appverpath.split('] (')133 (appver, comment) = appverfull.split(' [')134 (branch, full_version) = comment.split(': ')135 (app, ver) = appver.split(': ')136 137 self.failUnlessEqual(app, allmydata.__appname__, info)138 norm_ver = normalized_version(ver)139 norm_required = normalized_version(required_verstr)140 self.failUnlessEqual(norm_ver, norm_required, info)141 self.failUnlessEqual(path, srcdir, info)142 self.failUnlessEqual(branch, allmydata.branch)143 self.failUnlessEqual(full_version, allmydata.full_version)144 d.addCallback(_cb)145 return d146 147 74 def test_unicode_arguments_and_output(self): 148 75 tricky = u"\u2621" … … 166 93 def _cb(res): 167 94 out, err, rc_or_sig = res 168 self. failUnlessEqual(rc_or_sig, 0, str(res))169 self. failUnless(out.startswith(allmydata.__appname__+':'), str(res))95 self.assertEqual(rc_or_sig, 0, str(res)) 96 self.assertTrue(out.startswith(allmydata.__appname__ + '/'), str(res)) 170 97 d.addCallback(_cb) 171 98 return d -
TabularUnified src/allmydata/test/web/test_introducer.py ¶
r224085c rc694e8c 128 128 self, 129 129 soup, 130 u"%s: %s" % (allmydata.__appname__, allmydata.__version__),130 allmydata.__full_version__, 131 131 ) 132 132 assert_soup_has_text(self, soup, u"no peers!") -
TabularUnified src/allmydata/util/_python3.py ¶
r224085c rc694e8c 160 160 "allmydata.test.test_uri", 161 161 "allmydata.test.test_util", 162 "allmydata.test.test_version",163 162 ] -
TabularUnified src/allmydata/web/introweb.py ¶
r224085c rc694e8c 7 7 import allmydata 8 8 import json 9 from allmydata.version_checks import get_package_versions_string10 9 from allmydata.util import idlib 11 10 from allmydata.web.common import ( … … 90 89 self.node_data_dict = { 91 90 "my_nodeid": idlib.nodeid_b2a(self.introducer_node.nodeid), 92 "version": get_package_versions_string(),91 "version": allmydata.__full_version__, 93 92 "import_path": str(allmydata).replace("/", "/ "), # XXX kludge for wrapping 94 93 "rendered_at": render_time(time.time()), -
TabularUnified src/allmydata/web/root.py ¶
r224085c rc694e8c 22 22 23 23 import allmydata # to display import path 24 from allmydata.version_checks import get_package_versions_string25 24 from allmydata.util import log 26 25 from allmydata.interfaces import IFileNode … … 567 566 @renderer 568 567 def version(self, req, tag): 569 return tag( get_package_versions_string())568 return tag(allmydata.__full_version__) 570 569 571 570 @renderer
Note: See TracChangeset
for help on using the changeset viewer.