Changeset c694e8c in trunk


Ignore:
Timestamp:
2020-11-23T20:10:18Z (5 years ago)
Author:
Jean-Paul Calderone <exarkun@…>
Branches:
master
Children:
d03dece
Parents:
224085c
Message:

Delete allmydata.version_checks and related functionality

It is not Tahoe-LAFS' job to manage package installation in this way.
Instead, we can declare our dependencies in setup.py and rely on installation
management tools and packagers to create a suitable execution environment.

Making this statement in the past required going much further out on a limb
than it does today. This code has served its purpose and can now be retired.

Location:
src/allmydata
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/client.py

    r224085c rc694e8c  
    513513            str(allmydata.__full_version__),
    514514            str(_Client.OLDEST_SUPPORTED_VERSION),
    515             list(node.get_app_versions()),
    516515            partial(_sequencer, config),
    517516            introducer_cache_filepath,
  • TabularUnified src/allmydata/introducer/client.py

    r224085c rc694e8c  
    2525    def __init__(self, tub, introducer_furl,
    2626                 nickname, my_version, oldest_supported,
    27                  app_versions, sequencer, cache_filepath):
     27                 sequencer, cache_filepath):
    2828        self._tub = tub
    2929        self.introducer_furl = introducer_furl
     
    3333        self._my_version = my_version
    3434        self._oldest_supported = oldest_supported
    35         self._app_versions = app_versions
    3635        self._sequencer = sequencer
    3736        self._cache_filepath = cache_filepath
     
    3938        self._my_subscriber_info = { "version": 0,
    4039                                     "nickname": self._nickname,
    41                                      "app-versions": self._app_versions,
     40                                     "app-versions": [],
    4241                                     "my-version": self._my_version,
    4342                                     "oldest-supported": self._oldest_supported,
     
    191190                  # publish(), each time we make a change
    192191                  "nickname": self._nickname,
    193                   "app-versions": self._app_versions,
     192                  "app-versions": [],
    194193                  "my-version": self._my_version,
    195194                  "oldest-supported": self._oldest_supported,
  • TabularUnified src/allmydata/node.py

    r224085c rc694e8c  
    2929from twisted.application import service
    3030from twisted.python.failure import Failure
    31 from foolscap.api import Tub, app_versions
     31from foolscap.api import Tub
     32
    3233import foolscap.logging.log
    33 from allmydata.version_checks import get_package_versions, get_package_versions_string
     34
    3435from allmydata.util import log
    3536from allmydata.util import fileutil, iputil
     
    3839from allmydata.util.encodingutil import get_filesystem_encoding, quote_output
    3940from allmydata.util import configutil
     41
     42from . import (
     43    __full_version__,
     44)
    4045
    4146def _common_valid_config():
     
    7984    })
    8085
    81 # Add our application versions to the data that Foolscap's LogPublisher
    82 # 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 
    8986# group 1 will be addr (dotted quad string), group 3 if any will be portnum (string)
    9087ADDR_RE = re.compile("^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$")
     
    230227    configutil.validate_config(fname, parser, _valid_config)
    231228    return _Config(parser, portnumfile, basedir, fname)
    232 
    233 
    234 def get_app_versions():
    235     """
    236     :returns: dict of versions important to Foolscap
    237     """
    238     return dict(app_versions.versions)
    239229
    240230
     
    763753            self.control_tub.setServiceParent(self)
    764754
    765         self.log("Node constructed. " + get_package_versions_string())
     755        self.log("Node constructed. " + __full_version__)
    766756        iputil.increase_rlimits()
    767757
  • TabularUnified src/allmydata/scripts/runner.py

    r224085c rc694e8c  
    88from twisted.internet import defer, task, threads
    99
    10 from allmydata.version_checks import get_package_versions_string
    1110from allmydata.scripts.common import get_default_nodedir
    1211from allmydata.scripts import debug, create_node, cli, \
     
    2019)
    2120
     21from .. import (
     22    __full_version__,
     23)
     24
    2225_default_nodedir = get_default_nodedir()
    2326
     
    7881
    7982    def opt_version(self):
    80         print(get_package_versions_string(debug=True), file=self.stdout)
     83        print(__full_version__, file=self.stdout)
    8184        self.no_command_needed = True
    8285
    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
    8687
    8788    opt_eliot_destination = opt_eliot_destination
  • TabularUnified src/allmydata/test/cli/test_cli.py

    r224085c rc694e8c  
    12671267        stdout = StringIO()
    12681268        self.failUnlessRaises(SystemExit, self.parse, ["--version"], stdout)
    1269         self.failUnlessIn(allmydata.__appname__ + ":", stdout.getvalue())
     1269        self.failUnlessIn(allmydata.__full_version__, stdout.getvalue())
    12701270        # but "tahoe SUBCOMMAND --version" should be rejected
    12711271        self.failUnlessRaises(usage.UsageError, self.parse,
  • TabularUnified src/allmydata/test/common.py

    r224085c rc694e8c  
    111111    my_version = attr.ib()
    112112    oldest_supported = attr.ib()
    113     app_versions = attr.ib()
    114113    sequencer = attr.ib()
    115114    cache_filepath = attr.ib()
  • TabularUnified src/allmydata/test/test_client.py

    r224085c rc694e8c  
    4242from allmydata.node import OldConfigError, UnescapedHashError, create_node_dir
    4343from allmydata.frontends.auth import NeedRootcapLookupScheme
    44 from allmydata.version_checks import (
    45     get_package_versions_string,
    46 )
    4744from allmydata import client
    4845from allmydata.storage_client import (
     
    622619        self.failUnless("." in str(allmydata.__full_version__),
    623620                        "non-numeric version in '%s'" % allmydata.__version__)
    624         all_versions = get_package_versions_string()
    625         self.failUnless(allmydata.__appname__ in all_versions)
    626621        # also test stats
    627622        stats = c.get_stats()
  • TabularUnified src/allmydata/test/test_introducer.py

    r224085c rc694e8c  
    156156    def test_create(self):
    157157        ic = IntroducerClient(None, "introducer.furl", u"my_nickname",
    158                               "my_version", "oldest_version", {}, fakeseq,
     158                              "my_version", "oldest_version", fakeseq,
    159159                              FilePath(self.mktemp()))
    160160        self.failUnless(isinstance(ic, IntroducerClient))
     
    189189        ic1 = IntroducerClient(None,
    190190                               "introducer.furl", u"my_nickname",
    191                                "ver23", "oldest_version", {}, fakeseq,
     191                               "ver23", "oldest_version", fakeseq,
    192192                               FilePath(self.mktemp()))
    193193        # we use a second client just to create a different-looking
     
    195195        ic2 = IntroducerClient(None,
    196196                               "introducer.furl", u"my_nickname",
    197                                "ver24","oldest_version",{}, fakeseq,
     197                               "ver24","oldest_version",fakeseq,
    198198                               FilePath(self.mktemp()))
    199199        announcements = []
     
    299299        ic1 = IntroducerClient(None,
    300300                               "introducer.furl", u"my_nickname",
    301                                "ver23", "oldest_version", {}, realseq,
     301                               "ver23", "oldest_version", realseq,
    302302                               FilePath(self.mktemp()))
    303303        furl1 = "pb://62ubehyunnyhzs7r6vdonnm2hpi52w6y@127.0.0.1:36106/gydnp"
     
    397397        tub2.setServiceParent(self.parent)
    398398        c = IntroducerClient(tub2, ifurl,
    399                              u"nickname", "version", "oldest", {}, fakeseq,
     399                             u"nickname", "version", "oldest", fakeseq,
    400400                             FilePath(self.mktemp()))
    401401        furl1 = "pb://onug64tu@127.0.0.1:123/short" # base32("short")
     
    478478                                 NICKNAME % str(i),
    479479                                 "version", "oldest",
    480                                  {"component": "component-v1"}, fakeseq,
     480                                 fakeseq,
    481481                                 FilePath(self.mktemp()))
    482482            received_announcements[c] = {}
     
    738738        introducer = IntroducerService()
    739739        tub = introducer_furl = None
    740         app_versions = {"whizzy": "fizzy"}
    741740        client_v2 = IntroducerClient(tub, introducer_furl, NICKNAME % u"v2",
    742                                      "my_version", "oldest", app_versions,
     741                                     "my_version", "oldest",
    743742                                     fakeseq, FilePath(self.mktemp()))
    744743        #furl1 = "pb://62ubehyunnyhzs7r6vdonnm2hpi52w6y@127.0.0.1:0/swissnum"
     
    752751        s0 = subs[0]
    753752        self.failUnlessEqual(s0.service_name, "storage")
    754         self.failUnlessEqual(s0.app_versions, app_versions)
    755753        self.failUnlessEqual(s0.nickname, NICKNAME % u"v2")
    756754        self.failUnlessEqual(s0.version, "my_version")
     
    761759        introducer = IntroducerService()
    762760        tub = introducer_furl = None
    763         app_versions = {"whizzy": "fizzy"}
    764761        client_v2 = IntroducerClient(tub, introducer_furl, u"nick-v2",
    765                                      "my_version", "oldest", app_versions,
     762                                     "my_version", "oldest",
    766763                                     fakeseq, FilePath(self.mktemp()))
    767764        furl1 = "pb://62ubehyunnyhzs7r6vdonnm2hpi52w6y@127.0.0.1:0/swissnum"
     
    777774        self.assertThat(a[0].canary, Is(canary0))
    778775        self.failUnlessEqual(a[0].index, ("storage", public_key_str))
    779         self.failUnlessEqual(a[0].announcement["app-versions"], app_versions)
    780776        self.failUnlessEqual(a[0].nickname, u"nick-v2")
    781777        self.failUnlessEqual(a[0].service_name, "storage")
     
    855851        yield flushEventualQueue()
    856852        ic2 = IntroducerClient(None, "introducer.furl", u"my_nickname",
    857                                "my_version", "oldest_version", {}, fakeseq,
     853                               "my_version", "oldest_version", fakeseq,
    858854                               ic._cache_filepath)
    859855        announcements = {}
     
    955951        listenOnUnused(tub)
    956952        c = IntroducerClient(tub, self.introducer_furl,
    957                              u"nickname-client", "version", "oldest", {},
     953                             u"nickname-client", "version", "oldest",
    958954                             fakeseq, FilePath(self.mktemp()))
    959955        announcements = {}
     
    10281024            "0.0.0",
    10291025            "1.2.3",
    1030             {},
    10311026            (0, u"i am a nonce"),
    10321027            "invalid",
  • TabularUnified src/allmydata/test/test_node.py

    r224085c rc694e8c  
    4747    formatTimeTahoeStyle,
    4848    UnescapedHashError,
    49     get_app_versions,
    5049)
    5150from allmydata.introducer.server import create_introducer
     
    101100        # conflict with another service to prove it.
    102101        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 or
    109         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})
    113102
    114103    def _test_location(
  • TabularUnified src/allmydata/test/test_runner.py

    r224085c rc694e8c  
    1313from twisted.internet.defer import (
    1414    inlineCallbacks,
    15     returnValue,
    1615    DeferredList,
    1716)
     
    2120)
    2221from allmydata.util import fileutil, pollmixin
    23 from allmydata.util.encodingutil import unicode_to_argv, unicode_to_output, \
    24     get_filesystem_encoding
     22from allmydata.util.encodingutil import unicode_to_argv, unicode_to_output
    2523from allmydata.test import common_util
    26 from allmydata.version_checks import normalized_version
    2724import allmydata
    28 from allmydata import __appname__
    2925from .common_util import parse_cli, run_cli
    3026from .cli_node_api import (
     
    5955
    6056class RunBinTahoeMixin(object):
    61 
    62     @inlineCallbacks
    63     def find_import_location(self):
    64         res = yield self.run_bintahoe(["--version-and-path"])
    65         out, err, rc_or_sig = res
    66         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 
    7257    def run_bintahoe(self, args, stdin=None, python_options=[], env=None):
    7358        command = sys.executable
     
    8772
    8873class BinTahoe(common_util.SignalMixin, unittest.TestCase, RunBinTahoeMixin):
    89     @inlineCallbacks
    90     def test_the_right_code(self):
    91         # running "tahoe" in a subprocess should find the same code that
    92         # holds this test file, else something is weird
    93         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) and
    105                 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 = res
    117             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 d
    146 
    14774    def test_unicode_arguments_and_output(self):
    14875        tricky = u"\u2621"
     
    16693        def _cb(res):
    16794            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))
    17097        d.addCallback(_cb)
    17198        return d
  • TabularUnified src/allmydata/test/web/test_introducer.py

    r224085c rc694e8c  
    128128            self,
    129129            soup,
    130             u"%s: %s" % (allmydata.__appname__, allmydata.__version__),
     130            allmydata.__full_version__,
    131131        )
    132132        assert_soup_has_text(self, soup, u"no peers!")
  • TabularUnified src/allmydata/util/_python3.py

    r224085c rc694e8c  
    160160    "allmydata.test.test_uri",
    161161    "allmydata.test.test_util",
    162     "allmydata.test.test_version",
    163162]
  • TabularUnified src/allmydata/web/introweb.py

    r224085c rc694e8c  
    77import allmydata
    88import json
    9 from allmydata.version_checks import get_package_versions_string
    109from allmydata.util import idlib
    1110from allmydata.web.common import (
     
    9089        self.node_data_dict = {
    9190            "my_nodeid": idlib.nodeid_b2a(self.introducer_node.nodeid),
    92             "version": get_package_versions_string(),
     91            "version": allmydata.__full_version__,
    9392            "import_path": str(allmydata).replace("/", "/ "),  # XXX kludge for wrapping
    9493            "rendered_at": render_time(time.time()),
  • TabularUnified src/allmydata/web/root.py

    r224085c rc694e8c  
    2222
    2323import allmydata # to display import path
    24 from allmydata.version_checks import get_package_versions_string
    2524from allmydata.util import log
    2625from allmydata.interfaces import IFileNode
     
    567566    @renderer
    568567    def version(self, req, tag):
    569         return tag(get_package_versions_string())
     568        return tag(allmydata.__full_version__)
    570569
    571570    @renderer
Note: See TracChangeset for help on using the changeset viewer.