From 0aefd33d5851f916b248f5efdc484b35f1358897 Mon Sep 17 00:00:00 2001 From: Ken Woychesko Date: Mon, 12 May 2025 16:15:06 -0400 Subject: [PATCH] [FIX] #39: mkdir cross-platform on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced all plumbum.cmd.mkdir invocations that used GNU-style long-option forms for --mode and --parents with single-character flags (-m and -p). MacOS mkdir doesn’t support --mode or --parents in GNU-style long-option form. These work on GNU/Linux (Debian, Ubuntu, etc.), but macOS uses BSD-style utilities, where options are single-character flags like -p and -m (which also work on GNU/Linux). --- README.md | 2 +- newsfragments/39 | 2 ++ odoo_openupgrade_wizard/tools/tools_system.py | 4 ++-- tests/__init__.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 newsfragments/39 diff --git a/README.md b/README.md index 63d2df4..0409747 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ and provides helpers to run (and replay) migrations until it works. **Prerequites:** -* The tools run on debian system +* The tools run on both Debian and MacOS systems * You should have docker installed on your system * Some features require extra packages. To have all the features available run: diff --git a/newsfragments/39 b/newsfragments/39 new file mode 100644 index 0000000..e12bc7c --- /dev/null +++ b/newsfragments/39 @@ -0,0 +1,2 @@ +Fix BSD mkdir incompatibility on macOS by using single-character +flags for 'mode' and 'parents' for cross-platform folder creation (#39) diff --git a/odoo_openupgrade_wizard/tools/tools_system.py b/odoo_openupgrade_wizard/tools/tools_system.py index 057736e..7522ab9 100644 --- a/odoo_openupgrade_wizard/tools/tools_system.py +++ b/odoo_openupgrade_wizard/tools/tools_system.py @@ -35,8 +35,8 @@ def ensure_folder_exists( - a log is done at INFO level. """ if not folder_path.exists(): - cmd = ["--parents", folder_path] - cmd = ["--mode", mode] + cmd + cmd = ["-p", folder_path] + cmd = ["-m", mode] + cmd logger.info(f"Creating folder '{folder_path}' ...") mkdir(cmd) diff --git a/tests/__init__.py b/tests/__init__.py index b6de448..54116b7 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -25,7 +25,7 @@ def move_to_test_folder(): if os.getcwd().endswith("tests/data/output"): return test_folder_path = Path("tests/data/output") - mkdir([test_folder_path, "--parents"]) + mkdir(["-p", test_folder_path]) os.chdir(test_folder_path)