[FIX] #39: mkdir cross-platform on macOS

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).
This commit is contained in:
Ken Woychesko 2025-05-12 16:15:06 -04:00
parent 6bb379d92b
commit 0aefd33d58
4 changed files with 6 additions and 4 deletions

View File

@ -51,7 +51,7 @@ and provides helpers to run (and replay) migrations until it works.
**Prerequites:** **Prerequites:**
* The tools run on debian system * The tools run on both Debian and MacOS systems
* You should have docker installed on your system * You should have docker installed on your system
* Some features require extra packages. To have all the features available run: * Some features require extra packages. To have all the features available run:

2
newsfragments/39 Normal file
View File

@ -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)

View File

@ -35,8 +35,8 @@ def ensure_folder_exists(
- a log is done at INFO level. - a log is done at INFO level.
""" """
if not folder_path.exists(): if not folder_path.exists():
cmd = ["--parents", folder_path] cmd = ["-p", folder_path]
cmd = ["--mode", mode] + cmd cmd = ["-m", mode] + cmd
logger.info(f"Creating folder '{folder_path}' ...") logger.info(f"Creating folder '{folder_path}' ...")
mkdir(cmd) mkdir(cmd)

View File

@ -25,7 +25,7 @@ def move_to_test_folder():
if os.getcwd().endswith("tests/data/output"): if os.getcwd().endswith("tests/data/output"):
return return
test_folder_path = Path("tests/data/output") test_folder_path = Path("tests/data/output")
mkdir([test_folder_path, "--parents"]) mkdir(["-p", test_folder_path])
os.chdir(test_folder_path) os.chdir(test_folder_path)