set the build type

This commit is contained in:
jobevers 2017-02-15 18:50:38 -06:00
parent 9a21135223
commit 4763d29a4c
4 changed files with 33 additions and 2 deletions

View file

@ -10,7 +10,8 @@ clone_folder: C:\projects\lbry-electron
install:
# needed to deal with submodules
- git submodule update --init --recursive
- python set-version.py
- python set_version.py
- python set_build.py
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules

View file

@ -30,7 +30,8 @@ if [ "$FULL_BUILD" == "true" ]; then
source "$VENV/bin/activate"
set -u
pip install -U pip setuptools pyinstaller
python set-version.py
python set_version.py
python set_build.py
fi
npm install

29
set_build.py Normal file
View file

@ -0,0 +1,29 @@
"""Set the build version to be 'dev', 'qa', 'rc', 'release'"""
import json
import os.path
import re
import subprocess
import sys
def main():
build = get_build()
with open(os.path.join('lbry', 'lbrynet', 'build_type.py'), 'w') as f:
f.write('BUILD = "{}"'.format(build))
def get_build():
try:
tag = subprocess.check_output(['git', 'describe', '--exact-match']).strip()
if re.match('v\d+\.\d+\.\d+rc\d+', tag):
return 'rc'
else:
return 'release'
except subprocess.CalledProcessError:
# if the build doesn't have a tag
return 'qa'
if __name__ == '__main__':
sys.exit(main())