Skip to content

Commit

Permalink
Only update version & build if source has changed
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Feb 23, 2016
1 parent 30464ba commit 720f223
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
22 changes: 12 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-16 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -39,18 +39,20 @@
last_release = None
try:
import git
except ImportError:
git = None
if git:
try:
repo = git.Repo()
latest = 0
for tag in repo.tags:
if tag.tag.tagged_date > latest:
latest = tag.tag.tagged_date
last_release = str(tag)
last_commit = str(repo.head.commit)[:7]
except git.exc.InvalidGitRepositoryError:
if repo.is_dirty():
latest = 0
for tag in repo.tags:
if tag.tag.tagged_date > latest:
latest = tag.tag.tagged_date
last_release = str(tag)
last_commit = str(repo.head.commit)[:7]
except (git.exc.InvalidGitRepositoryError, git.exc.GitCommandNotFound):
pass
except ImportError:
pass

# regenerate version info, if required
if last_commit != _commit:
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '16.02.0.dev1344'
_release = '1344'
_commit = '6d4c346'
__version__ = '16.02.0.dev1345'
_release = '1345'
_commit = '30464ba'

0 comments on commit 720f223

Please sign in to comment.