Skip to content

Commit

Permalink
replace gitpython with git call
Browse files Browse the repository at this point in the history
  • Loading branch information
jstucke committed Feb 28, 2024
1 parent fd21fb2 commit 6d0e70e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/fact_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import signal
import sys
from pathlib import Path
from shlex import split
from subprocess import CalledProcessError, PIPE, run, STDOUT
from time import sleep

import config

try:
import git
import psutil
import psycopg2 # noqa: F401

Expand Down Expand Up @@ -53,9 +54,9 @@ def __init__(self):
@staticmethod
def _get_git_revision() -> str:
try:
repo = git.Repo(Path(__file__), search_parent_directories=True)
return f'commit {repo.head.object.hexsha}'
except git.exc.InvalidGitRepositoryError:
proc = run(split('git rev-parse --short HEAD'), stdout=PIPE, stderr=STDOUT, cwd=Path(__file__).parent)
return proc.stdout.decode().strip()
except CalledProcessError:
return 'unknown revision'

def _register_signal_handlers(self):
Expand Down
1 change: 0 additions & 1 deletion src/install/requirements_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ setuptools<66
# General python dependencies
appdirs==1.4.4
flaky==3.7.0
gitpython~=3.1.40
lief==0.12.3
psutil==5.9.4
psycopg2-binary==2.9.5
Expand Down

0 comments on commit 6d0e70e

Please sign in to comment.