diff --git a/.travis.yml b/.travis.yml index a1e0d1409..a64cbcb35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,6 +84,7 @@ jobs: - pip3 install pyinstaller - pip3 install git+https://github.com/lbryio/torba.git - pip3 install git+https://github.com/lbryio/lbryschema.git + - python scripts/set_build.py - pip3 install -e . script: - pyinstaller -F -n lbrynet lbrynet/cli.py diff --git a/scripts/set_build.py b/scripts/set_build.py new file mode 100644 index 000000000..01470d395 --- /dev/null +++ b/scripts/set_build.py @@ -0,0 +1,30 @@ + +"""Set the build version to be 'dev', 'qa', 'rc', 'release'""" + +import os.path +import re +import subprocess +import sys + + +def main(): + build = get_build() + root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + with open(os.path.join(root_dir, 'lbrynet', 'build_type.py'), 'w') as f: + f.write("BUILD = '{}'\n".format(build)) + + +def get_build(): + try: + tag = subprocess.check_output(['git', 'describe', '--exact-match', '--all']).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()) diff --git a/scripts/wine_build.sh b/scripts/wine_build.sh index 85578edf3..e6c8130f6 100755 --- a/scripts/wine_build.sh +++ b/scripts/wine_build.sh @@ -16,6 +16,7 @@ cd lbryschema && pip install -e . && cd .. cd torba && pip install -e . && cd .. cd lbry +python scripts/set_build.py pip install -e . pyinstaller --additional-hooks-dir=scripts/. -F -n lbrynet lbrynet/cli.py wine dist/lbrynet.exe --version