Skip to content

Commit 1f718c4

Browse files
committed
Fix NotADirectoryError in tools/pkg/build.py salt_onedir
Commit 9c268db added a `git add -f salt/_version.txt` invocation inside `salt_onedir` with `cwd=str(salt_archive)`, but `salt_archive` is a path to a `.tar.gz` file, not a directory. Python's subprocess implementation calls `chdir()` on `cwd` and raises: NotADirectoryError: [Errno 20] Not a directory: '/.../salt-3008.0+NNN.gSHA.tar.gz' This blocks the Build Salt Onedir job on Linux and macOS for every master PR. The Windows path takes a different branch (`pkg\\windows\\install_salt.cmd`) and is unaffected. The `salt_onedir` step runs in the salt source checkout (the CI working tree), which is a real git repository containing `salt/_version.txt`, so dropping the `cwd=` argument lets the subprocess inherit that directory and the `git add` works as the original commit intended. Reproducer: import subprocess subprocess.run(['echo', 'x'], cwd='/tmp/anything.tar.gz') # NotADirectoryError: [Errno 20] Not a directory: '/tmp/anything.tar.gz' Fixes #69461 Refs 9c268db
1 parent 0bacd93 commit 1f718c4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

changelog/69461.fixed.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fix ``NotADirectoryError`` in ``tools/pkg/build.py`` ``salt_onedir`` by no
2+
longer passing the source tarball path as the ``cwd=`` of the
3+
``git add -f salt/_version.txt`` subprocess; the command now runs in the
4+
salt source checkout (a real git working tree) as intended.

0 commit comments

Comments
 (0)