From ae2bc020eb81f7a92d538c210d70d1a14a7645cc Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 9 May 2020 22:35:44 -0700 Subject: [PATCH] git status check - linux and darwin --- detect.py | 1 - utils/utils.py | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/detect.py b/detect.py index 635d7059..15582a5d 100644 --- a/detect.py +++ b/detect.py @@ -1,5 +1,4 @@ import argparse -from sys import platform from models import * # set ONNX_EXPORT in models.py from utils.datasets import * diff --git a/utils/utils.py b/utils/utils.py index d6d9f947..a07c430c 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -5,6 +5,7 @@ import random import shutil import subprocess from pathlib import Path +from sys import platform import cv2 import matplotlib @@ -33,10 +34,11 @@ def init_seeds(seed=0): def check_git_status(): - # Suggest 'git pull' if repo is out of date - s = subprocess.check_output('if [ -d .git ]; then git fetch && git status -uno; fi', shell=True).decode('utf-8') - if 'Your branch is behind' in s: - print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n') + if platform in ['linux', 'darwin']: + # Suggest 'git pull' if repo is out of date + s = subprocess.check_output('if [ -d .git ]; then git fetch && git status -uno; fi', shell=True).decode('utf-8') + if 'Your branch is behind' in s: + print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n') def load_classes(path):