~mojo-maintainers/mojo/trunk

« back to all changes in this revision

Viewing changes to mojo/spec.py

  • Committer: mergebot at canonical
  • Author(s): "Barry Price"
  • Date: 2021-02-05 13:04:37 UTC
  • mfrom: (579.1.1 mojo)
  • Revision ID: mergebot@juju-139df4-prod-is-toolbox-0.canonical.com-20210205130437-z2nmmhhe0ga2yndp
Apply Makefile's blacken rules under current latest LTS (20.04)

Reviewed-on: https://code.launchpad.net/~barryprice/mojo/blacken/+merge/397569
Reviewed-by: Tom Haddon <tom.haddon@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
 
14
14
class Spec(object):
15
 
    """ Representation for an on disk spec
16
 
        The spec is initialized to the proper state when an object is created and then a number of helper
17
 
        methods for navigating the specs contents are provided.
 
15
    """Representation for an on disk spec
 
16
    The spec is initialized to the proper state when an object is created and then a number of helper
 
17
    methods for navigating the specs contents are provided.
18
18
    """
19
19
 
20
20
    def __init__(self, spec_dir, url=None, stage=None, manifest_file=None):
64
64
 
65
65
    def get_configs(self, base, stage=None):
66
66
        """Locate a list of stage-qualified configuration files.
67
 
           Configs are returned relative to the spec dir from
68
 
           least specific to most specfic in this order:
69
 
             * <base>
70
 
             * <stage>/../<base>
71
 
             * <stage>/<base>"""
 
67
        Configs are returned relative to the spec dir from
 
68
        least specific to most specfic in this order:
 
69
          * <base>
 
70
          * <stage>/../<base>
 
71
          * <stage>/<base>"""
72
72
        if base[0] == "/":
73
73
            raise InvalidConfigException("Invalid fully qualified config path specified: {}".format(base))
74
74
        config_names = []
102
102
 
103
103
    def get_config(self, base, stage=None):
104
104
        """Locate a stage-qualified configuration file.
105
 
           The absolute path to the most specific match,
106
 
           the first of the following configs is returned:
107
 
             * <stage>/<base>
108
 
             * <stage>/../<base>
109
 
             * <base>"""
 
105
        The absolute path to the most specific match,
 
106
        the first of the following configs is returned:
 
107
          * <stage>/<base>
 
108
          * <stage>/../<base>
 
109
          * <base>"""
110
110
        # The last element is the most specific matching path
111
111
        return os.path.join(self.dir, self.get_configs(base, stage)[-1])
112
112