diff --git a/NEWS.rst b/NEWS.rst index 9fec47b0c5b26333bb33681c7a5f96cc39093340_TkVXUy5yc3Q=..92776f972d58613adb40b6d48eec9c1de47fcedd_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -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 ----- diff --git a/odoo_scripts/config.py b/odoo_scripts/config.py index 9fec47b0c5b26333bb33681c7a5f96cc39093340_b2Rvb19zY3JpcHRzL2NvbmZpZy5weQ==..92776f972d58613adb40b6d48eec9c1de47fcedd_b2Rvb19zY3JpcHRzL2NvbmZpZy5weQ== 100644 --- a/odoo_scripts/config.py +++ b/odoo_scripts/config.py @@ -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) diff --git a/odoo_scripts/list_modules.py b/odoo_scripts/list_modules.py index 9fec47b0c5b26333bb33681c7a5f96cc39093340_b2Rvb19zY3JpcHRzL2xpc3RfbW9kdWxlcy5weQ==..92776f972d58613adb40b6d48eec9c1de47fcedd_b2Rvb19zY3JpcHRzL2xpc3RfbW9kdWxlcy5weQ== 100644 --- a/odoo_scripts/list_modules.py +++ b/odoo_scripts/list_modules.py @@ -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__":