Skip to content
Snippets Groups Projects

Topic/default/allow nesting blacklisting

2 files
+ 31
3
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 25
2
@@ -32,6 +32,10 @@
"""
def __init__(
self, path: str = None, blacklist: str = None, read: str = None
self,
path: str = None,
blacklist: str = None,
read: str = None,
parent_configuration=None,
):
self._expanded_configuration = dict()
@@ -36,5 +40,6 @@
):
self._expanded_configuration = dict()
self.path = path
setup_path = "setup.cfg"
if path:
setup_path = os.path.join(path, setup_path)
@@ -57,7 +62,8 @@
] = section.get(key)
for name, value in expanded_info.items():
value["parent_configuration"] = self
if "path" not in value:
_logger.error("Expansion without path for %s", name)
raise Exception("Expansion without path for %s" % name)
else:
@@ -60,8 +66,25 @@
if "path" not in value:
_logger.error("Expansion without path for %s", name)
raise Exception("Expansion without path for %s" % name)
else:
if blacklist and re.match(blacklist, value["path"]):
# put in relative_path the relative path between this and the
# parent.
# this allows blacklisting odoo-mint/theme when expanding
# mint hr.
if parent_configuration:
# difference between this path and the parents
relative_path = os.path.join(
os.path.relpath(
path,
parent_configuration.path
if parent_configuration.path
else "",
),
value["path"],
)
else:
relative_path = value["path"]
if blacklist and re.match(blacklist, relative_path):
_logger.info(
"Ignoring directory '%s' due to blacklisting",
os.path.join(path, value["path"])
Loading