(self)
| 152 | return self.load_config_from_module_name_or_filename(location=filename) |
| 153 | |
| 154 | def load_config(self): |
| 155 | # parse console args |
| 156 | parser = self.cfg.parser() |
| 157 | args = parser.parse_args() |
| 158 | |
| 159 | # optional settings from apps |
| 160 | cfg = self.init(parser, args, args.args) |
| 161 | |
| 162 | # set up import paths and follow symlinks |
| 163 | self.chdir() |
| 164 | |
| 165 | # Load up the any app specific configuration |
| 166 | if cfg: |
| 167 | for k, v in cfg.items(): |
| 168 | self.cfg.set(k.lower(), v) |
| 169 | |
| 170 | env_args = parser.parse_args(self.cfg.get_cmd_args_from_env()) |
| 171 | |
| 172 | if args.config: |
| 173 | self.load_config_from_file(args.config) |
| 174 | elif env_args.config: |
| 175 | self.load_config_from_file(env_args.config) |
| 176 | else: |
| 177 | default_config = get_default_config_file() |
| 178 | if default_config is not None: |
| 179 | self.load_config_from_file(default_config) |
| 180 | |
| 181 | # Load up environment configuration |
| 182 | for k, v in vars(env_args).items(): |
| 183 | if v is None: |
| 184 | continue |
| 185 | if k == "args": |
| 186 | continue |
| 187 | self.cfg.set(k.lower(), v) |
| 188 | |
| 189 | # Lastly, update the configuration with any command line settings. |
| 190 | for k, v in vars(args).items(): |
| 191 | if v is None: |
| 192 | continue |
| 193 | if k == "args": |
| 194 | continue |
| 195 | self.cfg.set(k.lower(), v) |
| 196 | |
| 197 | # current directory might be changed by the config now |
| 198 | # set up import paths and follow symlinks |
| 199 | self.chdir() |
| 200 | |
| 201 | def run(self): |
| 202 | if self.cfg.print_config: |
nothing calls this directly
no test coverage detected