Skip to content

Commit 38b090e

Browse files
committed
setup.py: handle git not being installed
My previous change to call git unconditionally caused Packit failures, presumably because git isn't installed for the build: Traceback (most recent call last): File "/builddir/build/BUILD/drgn-0.0.22+71.g2f97cc0/setup.py", line 411, in <module> version=get_version(), ^^^^^^^^^^^^^ File "/builddir/build/BUILD/drgn-0.0.22+71.g2f97cc0/setup.py", line 343, in get_version subprocess.call( File "/usr/lib64/python3.11/subprocess.py", line 389, in call with Popen(*popenargs, **kwargs) as p: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.11/subprocess.py", line 1024, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib64/python3.11/subprocess.py", line 1901, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'git' We shouldn't bother calling git if .git doesn't exist. Fixes: 2e9e66c ("setup.py: use stricter check for git repository") Signed-off-by: Omar Sandoval <[email protected]>
1 parent 2f97cc0 commit 38b090e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def get_version():
339339

340340
# If this is a git repository, use a git-describe(1)-esque local version.
341341
# Otherwise, get the local version saved in the sdist.
342-
if (
342+
if os.path.exists(".git") and (
343343
subprocess.call(
344344
["git", "--git-dir=.git", "rev-parse"], stderr=subprocess.DEVNULL
345345
)

0 commit comments

Comments
 (0)