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

:sparkles: allow nested blacklisting

For example, allow ignoring odoo-mint/theme when expanding odoo-mint-hr.
:hammer: Change list_modules command to output in the console when used.
parent 9fec47b0
No related branches found
No related tags found
1 merge request!34✨ allow nested blacklisting
......@@ -2,7 +2,7 @@
History
=======
7.0.6
8.0.0
-----
flake8 and isort are not run by default when running docker_dev_start.
......@@ -11,6 +11,11 @@
import_* follow symlinks.
✨ allow nested blacklistin:
For example, allow ignoring odoo-mint/theme when expanding odoo-mint-hr.
🔨 Change list_modules command to output in the console when used.
7.0.5
-----
......
......@@ -61,7 +61,23 @@
_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 re_path everything but the first path element
# this allows blacklisting odoo-mint/theme when expanding
# mint hr.
if path:
d = os.path.split(path)
p = ""
while d:
d, tail = d
if d:
p = os.path.join(tail, p)
d = os.path.split(d)
re_path = (
os.path.join(p, value["path"]) if p else value["path"]
)
else:
re_path = value["path"]
if blacklist and re.match(blacklist, re_path):
_logger.info(
"Ignoring directory '%s' due to blacklisting",
os.path.join(path, value["path"])
......@@ -71,6 +87,14 @@
else:
if path:
value["path"] = os.path.join(path, value["path"])
if blacklist:
if "blacklist" in value:
# combine the two regexp
value["blacklist"] = "{}|{}".format(
value["blacklist"], blacklist
)
else:
value["blacklist"] = blacklist
# read expanded configurations
self._expanded_configuration[name] = Configuration(**value)
......
......@@ -54,7 +54,7 @@
parser = basic_parser(program_license, program_version_message)
nmspc = parser.parse_args()
apply(nmspc)
list_modules()
list_modules(None)
def list_modules(filename: str = MODULES_LIST_FILE):
......@@ -58,8 +58,12 @@
def list_modules(filename: str = MODULES_LIST_FILE):
with open(filename, "w") as f:
f.write(",".join(Config().module_list))
output = ",".join(Config().module_list)
if filename:
with open(filename, "w") as f:
f.write(output)
else:
print(output)
if __name__ == "__main__":
......
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