Explorar o código

Allow for 'no_prefix' in load with as section.

Aurelien %!s(int64=5) %!d(string=hai) anos
pai
achega
13ee53b49a
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      byrd/cli.py

+ 5 - 2
byrd/cli.py

@@ -43,12 +43,15 @@ def load_cfg(path, prefix=None):
                 child_path = os.path.join(PKG_DIR, item.pkg)
 
             if item.get('as'):
-                child_prefix = item['as']
+                if item['as'] == 'no_prefix':
+                    child_prefix = None
+                else:
+                    child_prefix = item['as']
             else:
                 child_prefix, _ = os.path.splitext(rel_path)
 
             child_cfg = load_cfg(child_path, child_prefix)
-            key_fn = lambda x: '/'.join([child_prefix, x])
+            key_fn = lambda x: '/'.join(filter(None, [child_prefix, x]))
             for section in load_sections:
                 if section not in child_cfg:
                     continue