Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also get buildslave's version from GIT.
- Loading branch information
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
# strategy: | ||
# | ||
# if there is a VERSION file, use its contents. otherwise, call git to | ||
# get a version string. if that also fails, use 'latest'. | ||
# | ||
import os | ||
|
||
version = "latest" | ||
|
||
try: | ||
fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION') | ||
version = open(fn).read().strip() | ||
|
||
except IOError: | ||
from subprocess import Popen, PIPE | ||
import re | ||
|
||
VERSION_MATCH = re.compile(r'\d+\.\d+\.\d+(\w|-)*') | ||
|
||
try: | ||
p = Popen(['git', 'describe', '--tags', '--always', '--dirty'], stdout=PIPE) | ||
out = p.communicate()[0] | ||
|
||
if (not p.returncode) and out: | ||
v = VERSION_MATCH.search(out) | ||
if v: | ||
version = v.group() | ||
except OSError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters