Changeset 6d4a8bc in trunk for src/allmydata/scripts/common.py


Ignore:
Timestamp:
2016-01-15T19:15:38Z (10 years ago)
Author:
Daira Hopwood <daira@…>
Branches:
master
Children:
6226f6b
Parents:
41cf6008 (diff), f282445 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge pull request #220 from tahoe-lafs/2669.magic-folder-misc-patches.1

This PR is a bunch of miscellaneous patches that are on the Magic Folder branches, but independent of Magic Folder itself.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/scripts/common.py

    r41cf6008 r6d4a8bc  
    5858
    5959    def parseArgs(self, basedir=None):
    60         if self.parent['node-directory'] and self['basedir']:
     60        # This finds the node-directory option correctly even if we are in a subcommand.
     61        root = self.parent
     62        while root.parent is not None:
     63            root = root.parent
     64
     65        if root['node-directory'] and self['basedir']:
    6166            raise usage.UsageError("The --node-directory (or -d) and --basedir (or -C) options cannot both be used.")
    62         if self.parent['node-directory'] and basedir:
     67        if root['node-directory'] and basedir:
    6368            raise usage.UsageError("The --node-directory (or -d) option and a basedir argument cannot both be used.")
    6469        if self['basedir'] and basedir:
     
    6974        elif self['basedir']:
    7075            b = argv_to_abspath(self['basedir'])
    71         elif self.parent['node-directory']:
    72             b = argv_to_abspath(self.parent['node-directory'])
     76        elif root['node-directory']:
     77            b = argv_to_abspath(root['node-directory'])
    7378        elif self.default_nodedir:
    7479            b = self.default_nodedir
     
    7681            raise usage.UsageError("No default basedir available, you must provide one with --node-directory, --basedir, or a basedir argument")
    7782        self['basedir'] = b
     83        self['node-directory'] = b
    7884
    7985    def postOptions(self):
Note: See TracChangeset for help on using the changeset viewer.