Skip to content

Commit

Permalink
profile-time: workaround for flake8-encodings bug
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin committed Jul 13, 2023
1 parent 9e9f120 commit 6b81c77
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions scripts/profile-time.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,16 @@
logger = logging.getLogger("capa.profile")


def subshell(cmd):
return subprocess.run(cmd, shell=True, capture_output=True, text=True).stdout.strip()


def main(argv=None):
if argv is None:
argv = sys.argv[1:]

label = subprocess.run(
"git show --pretty=oneline --abbrev-commit | head -n 1", shell=True, capture_output=True, text=True
).stdout.strip()
is_dirty = (
subprocess.run(
"git status | grep 'modified: ' | grep -v 'rules' | grep -v 'tests/data'",
shell=True,
capture_output=True,
text=True,
).stdout
!= ""
)
label = subshell("git show --pretty=oneline --abbrev-commit | head -n 1").strip()
is_dirty = subshell("git status | grep 'modified: ' | grep -v 'rules' | grep -v 'tests/data'") != ""

if is_dirty:
label += " (dirty)"
Expand Down

0 comments on commit 6b81c77

Please sign in to comment.