Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Commit

Permalink
format and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
phumberdroz committed Mar 17, 2018
1 parent 252bbe1 commit 34d1801
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
6 changes: 5 additions & 1 deletion .tf47Tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ def createmapvariants():
# pathlib.Path().mkdir(parents=True, exist_ok=True)
shutil.copytree('../', dest,
ignore=shutil.ignore_patterns('.tf47Tools', '.tf47MapVariants', '.git', '.DS_Store',
'.gitignore', 'ma3a'))
'.gitignore', 'ma3a', '.tf47Attachments', '.travis.yml')

)


root_src_dir = os.path.join(os.path.abspath(path), island)
root_dst_dir = dest
for src_dir, dirs, files in os.walk(root_src_dir):
Expand Down
29 changes: 16 additions & 13 deletions .tf47Tools/deploy.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
import os
import subprocess as sp
import sys
import shutil
import traceback
import subprocess as sp
from github3 import login

import yaml
scriptDir= os.path.join(os.path.dirname(__file__))
buildDir =os.path.join(scriptDir, 'builds')
from github3 import login

scriptDir = os.path.join(os.path.dirname(__file__))
buildDir = os.path.join(scriptDir, 'builds')
with open(os.path.join(scriptDir, '.tf47Config.yml'), 'r') as ymlfile:
cfg = yaml.load(ymlfile)

REPOUSER = cfg['GitHub']['org']
REPONAME = cfg['GitHub']['repo']
REPOPATH = "{}/{}".format(REPOUSER,REPONAME)
REPOPATH = "{}/{}".format(REPOUSER, REPONAME)


def create_release(repo):
label = sp.check_output(["git", "describe", "--tags"]).decode('ascii').strip().split("-")[0]
label = '{}-beta.{}'.format(label, os.environ["TRAVIS_BUILD_NUMBER"])
label = '{}-beta.{}'.format(label, os.environ["TRAVIS_BUILD_NUMBER"])
print(label)
release = repo.create_release(label, prerelease=True, draft=True)
for file in os.listdir(buildDir):
if file.endswith(".pbo"):
release.upload_asset(content_type="application/octet-stream", name=file, asset=open(os.path.join(buildDir, file), "rb").read())
release.upload_asset(content_type="application/octet-stream", name=file,
asset=open(os.path.join(buildDir, file), "rb").read())


def main():
print("Obtaining token ...")
try:
token = os.environ["GH_TOKEN"]
g =login(token=token)
g = login(token=token)
repo = g.repository(REPOUSER, REPONAME)
except:
print("Could not obtain token.")
print(traceback.format_exc())
return 1
else:
print("Token sucessfully obtained.")
print("Token successfully obtained.")

print("\nCreating Release")
try:
create_release(repo)
except:
print("Failed to update translation issue.")
print("Failed to create release.")
print(traceback.format_exc())
return 1
else:
print("Translation issue successfully updated.")
print("Release successfully created and assets uploaded.")

return 0


if __name__ == "__main__":
sys.exit(main())
sys.exit(main())

0 comments on commit 34d1801

Please sign in to comment.