Merge branch 'master' into price_optimize

This commit is contained in:
DarkPhoenix
2019-02-19 13:47:49 +03:00
18 changed files with 292 additions and 200 deletions

23
scripts/dump_version.py Normal file
View File

@@ -0,0 +1,23 @@
"""
This script is solely used when generating builds. It generates a version number automatically using
git tags as it's basis. Whenever a build is created, run this file beforehand and it should replace
the old version number with the new one in VERSION.YML
"""
import yaml
import subprocess
import os
with open("version.yml", 'r+') as file:
data = yaml.load(file)
file.seek(0)
file.truncate()
# todo: run Version() on the tag to ensure that it's of proper formatting - fail a test if not and prevent building
# python's versioning spec doesn't handle the same format git describe outputs, so convert it.
label = os.environ["PYFA_VERSION"].split('-') if "PYFA_VERSION" in os.environ else subprocess.check_output(["git", "describe", "--tags"]).strip().decode().split('-')
label = '-'.join(label[:-2])+'+'+'-'.join(label[-2:]) if len(label) > 1 else label[0]
print(label)
data['version'] = label
yaml.dump(data, file, default_flow_style=False)

11
scripts/package-osx.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
echo "${PYFA_VERSION}"
cat version.yml
python3 -m PyInstaller -y --clean --windowed dist_assets/mac/pyfa.spec
cd dist
zip -r "pyfa-$PYFA_VERSION-mac.zip" pyfa.app
curl --upload-file "pyfa-$PYFA_VERSION-mac.zip" https://transfer.sh/
echo -e "\n"
md5 -r "pyfa-$PYFA_VERSION-mac.zip"

7
scripts/setup-osx.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
wget "https://www.python.org/ftp/python/${PYTHON}/python-${PYTHON}-macosx10.6.pkg"
sudo installer -pkg python-${PYTHON}-macosx10.6.pkg -target /
sudo python3 -m ensurepip
# A manual check that the correct version of Python is running.
python3 --version
pip3 install -r requirements.txt