Skip to content

Commit

Permalink
fixed setup.py to build not in a git repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBarker-NOAA committed Sep 7, 2018
1 parent 9684cb2 commit 8ca33d7
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import fnmatch
import shutil
from datetime import datetime

from setuptools import setup, find_packages
from distutils.command.clean import clean
Expand All @@ -12,20 +13,28 @@
from setuptools.command.test import test as TestCommand

from git import Repo
from git.exc import InvalidGitRepositoryError

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
pkg_name = 'oil_library'
pkg_version = '1.1.0'
pkg_version = '1.1.1'

repo = Repo('.')

# try to get update date from repo
try:
branch_name = repo.active_branch.name
except TypeError:
repo = Repo('.')
try:
branch_name = repo.active_branch.name
except TypeError:
branch_name = 'no-branch'
last_update = repo.iter_commits().next().committed_datetime.isoformat()
except InvalidGitRepositoryError:
# not builiding in a valid git repo
# use today's date.
print "not in a valid git repo -- using today's date as build date"
branch_name = 'no-branch'

last_update = repo.iter_commits().next().committed_datetime.isoformat(),
last_update = datetime.now().isoformat()


def clean_files(del_db=False):
Expand Down

0 comments on commit 8ca33d7

Please sign in to comment.