Skip to content
Snippets Groups Projects
Commit 1062ce4eb3c3 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:ambulance: fix nested blacklisting

parent 2aaac04452e7
No related branches found
No related tags found
1 merge request!41Topic/default/allow nesting blacklisting
This commit is part of merge request !41. Comments created here will be created in the context of that merge request.
......@@ -2,6 +2,11 @@
History
=======
8.0.1
-----
Fix nested blacklisting.
8.0.0
-----
......@@ -11,7 +16,7 @@
import_* follow symlinks.
✨ allow nested blacklistin:
✨ allow nested blacklisting:
For example, allow ignoring odoo-mint/theme when expanding odoo-mint-hr.
🔨 Change list_modules command to output in the console when used.
......
......@@ -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"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment