From 2f642db61a10825dccae2c300e095d251d0e6542 Mon Sep 17 00:00:00 2001 From: Stewie Date: Sun, 10 Apr 2022 17:37:01 -0400 Subject: [PATCH 1/2] Create functions for interacting with our Repos --- RepoFunctions.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 RepoFunctions.py diff --git a/RepoFunctions.py b/RepoFunctions.py new file mode 100644 index 0000000..2512716 --- /dev/null +++ b/RepoFunctions.py @@ -0,0 +1,19 @@ +import requests +import json + +def get_Releases(org, repo_name, latest=False): + + #git_url = "https://api.github.com/repos/SymphoniaLauren/Tales-of-Rebirth/releases" + git_url = "https://api.github.com/repos/{}/{}/releases".format(org, repo_name) + + if latest: + git_url = git_url+"/latest" + + header = { + "Accept":"application/vnd.github.v3+json" + } + + res = requests.get(git_url) + json_res = json.loads(res.text) + + return json_res \ No newline at end of file From 63d50555f23bae24201b376a015dd17f1e3588af Mon Sep 17 00:00:00 2001 From: Stewie Date: Sun, 10 Apr 2022 17:46:47 -0400 Subject: [PATCH 2/2] Adding function to refresh repo on the VM --- RepoFunctions.py | 14 +++++++++++++- ToolsTales_Executable.py | 19 ++++--------------- __pycache__/ApacheAutomate.cpython-38.pyc | Bin 3208 -> 3208 bytes 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/RepoFunctions.py b/RepoFunctions.py index 2512716..32de3ef 100644 --- a/RepoFunctions.py +++ b/RepoFunctions.py @@ -1,5 +1,7 @@ +import os import requests import json +import subprocess def get_Releases(org, repo_name, latest=False): @@ -16,4 +18,14 @@ def get_Releases(org, repo_name, latest=False): res = requests.get(git_url) json_res = json.loads(res.text) - return json_res \ No newline at end of file + return json_res + + +def refresh_repo(repo_name): + + base_path = os.path.join(os.getcwd(), "..", repo_name) + print("Repo to refresh: {}".format(base_path)) + listFile = subprocess.run( + ["git", "pull", repo_name], + cwd=base_path + ) diff --git a/ToolsTales_Executable.py b/ToolsTales_Executable.py index 1b59e49..6981932 100644 --- a/ToolsTales_Executable.py +++ b/ToolsTales_Executable.py @@ -8,6 +8,7 @@ import re import requests import subprocess import ApacheAutomate +import RepoFunctions SCRIPT_VERSION = "0.3" @@ -16,22 +17,7 @@ def generate_xdelta_patch(original_path, new_path, xdelta_name="Tales-Of-Rebirth subprocess.run(["xdelta", "-s", original_path, new_path, xdelta_name]) -def get_Releases(org, repo_name, latest=False): - - #git_url = "https://api.github.com/repos/SymphoniaLauren/Tales-of-Rebirth/releases" - git_url = "https://api.github.com/repos/{}/{}/releases".format(org, repo_name) - - if latest: - git_url = git_url+"/latest" - - header = { - "Accept":"application/vnd.github.v3+json" - } - res = requests.get(git_url) - json_res = json.loads(res.text) - - return json_res def get_directory_path(path): return os.path.dirname(os.path.abspath(path)) @@ -208,6 +194,9 @@ if __name__ == "__main__": tales_instance.bytes_to_text_with_offset( args.param1, int(args.param2)) if args.action == "pack": + RepoFunctions.refresh_repo("PythonLib") + RepoFunctions.refresh_repo("Tales-Of-Rebirth") + if args.file == "SLPS": #SLPS diff --git a/__pycache__/ApacheAutomate.cpython-38.pyc b/__pycache__/ApacheAutomate.cpython-38.pyc index 7506e658a08278778c0577f9a95d5a3b9c8fbd1e..781b546ac741e5f139aa3e076f2f37897282741e 100644 GIT binary patch delta 19 acmeB>?2zON<>lpKU|?V{^xeo+#{&Q)1p|oy delta 19 acmeB>?2zON<>lpKU|?Wq_1?%;#{&Q*^8?!e