blurstudio / hab

A application environment and launcher
GNU Lesser General Public License v3.0
25 stars 3 forks source link

Fix Placeholder parsing and improve os_specific #10

Closed MHendricks closed 2 years ago

MHendricks commented 2 years ago

Checklist

Types of Changes

Proposed Changes

Fixes exception raised if you use a uri that would hit a Placeholder object.

For the given configs:

$ hab dump . -t f
-------------------- Configs ---------------------
app
    hab.parsers.placeholder.Placeholder('app')
    |-- hab.parsers.config.Config('app/houdini19_py2')
    +-- hab.parsers.config.Config('app/maya2020')
default
    hab.parsers.config.Config('default')

trying to access a non-defined config in the same tree as app results in a error:

$ hab dump app/invalid
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  ...
  File "C:\blur\dev\hab_\hab\parsers\flat_config.py", line 26, in _collect_values
    logger.debug("Loading node: {} inherits: {}".format(node.name, node.inherits))
AttributeError: 'Placeholder' object has no attribute 'inherits'

This fixes the error by enabling inherits for all Placeholder objects, and fixing a bug where it wouldn't fall back to default in that case. That code wasn't being tested, but is now.

Also added tests for the os_specific feature on site json files and for environment variable definitions.