Skip to content

Commit 1142bf1

Browse files
committed
fix release robot
1 parent 40af529 commit 1142bf1

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

carousel/__init__.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,31 @@
55
"""
66

77
from carousel.release_robot import get_current_version
8+
from dulwich.repo import NotGitRepository
9+
import os
10+
11+
BASEDIR = os.path.dirname(__file__)
12+
13+
14+
def get_or_create_version(verfile='version.py'):
15+
try:
16+
git_version = get_current_version()
17+
except (ImportError, NotGitRepository):
18+
git_version = None
19+
try:
20+
from carousel.version import VERSION
21+
except ImportError:
22+
VERSION = None
23+
if git_version is not None and VERSION != git_version:
24+
with open(os.path.join(BASEDIR, verfile), 'w') as vf:
25+
vf.write('VERSION = "%s"\n' % git_version)
26+
else:
27+
git_version = VERSION
28+
return git_version
29+
830

931
__author__ = u'Mark Mikofski'
1032
__email__ = u'mark.mikofski@sunpowercorp.com'
1133
__url__ = u'https://github.com/SunPower/Carousel'
12-
__version__ = get_current_version()
34+
__version__ = get_or_create_version()
1335
__release__ = u'Caramel Corn'

0 commit comments

Comments
 (0)