Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions aab/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import logging

from .utils import call_shell
from .utils import call_shell, isMac


class Git(object):
Expand Down Expand Up @@ -78,13 +78,14 @@ def modtime(self, version):
if version == "dev":
# Get timestamps of uncommitted changes and return the most recent.
# https://stackoverflow.com/a/14142413
statcmd = "stat -f %m" if isMac else "stat -c %Y"
cmd = (
"git status -s | while read mode file;"
" do echo $(stat -c %Y $file); done"
f" do echo $({statcmd} $file); done"
)
modtimes = call_shell(cmd).splitlines()
# https://stackoverflow.com/a/12010656
modtimes = [int(modtime) for modtime in modtimes]
modtimes = [int(modtime) for modtime in modtimes if modtime != ""]
return max(modtimes)
else:
return int(call_shell("git log -1 -s --format=%ct {}".format(version)))
4 changes: 4 additions & 0 deletions aab/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import logging
import subprocess
import sys
import platform

from . import PATH_ROOT

Expand Down Expand Up @@ -84,3 +85,6 @@ def copy_recursively(source, target):
return call_shell(
'cp -r "{source}" "{target}"'.format(source=source, target=target)
)


isMac = platform.system() == "Darwin"