示例#1
0
 def compare_tree(self, branch):
     tree = self.get_tree(branch)
     if tree is not None:
         for file, i in tree.items():
             if not os.path.exists(file):
                 if i["type"] == "tree":
                     os.makedirs(file)
                 else:
                     locales.adv_print("FILE_IS_MISSING",
                                       globals={"file": file})
                     utils.download_file_with_bar(
                         self.get_download_url(branch, file), file)
示例#2
0
 def diff_commits(self, base, head):
     r = requests.get(
         f"https://api.github.com/repos/{self.name}/compare/{base}...{head}"
     ).json()
     self.__verify_request(r)
     show_commits = settings["show_last_X_commits"]
     locales.adv_print("COMMIT_DIFF_RESULTS",
                       globals={
                           "ahead_commits": r["ahead_by"],
                           "last_count": show_commits
                       })
     for commit in r["commits"][-show_commits::]:
         print(f"[+] {commit['commit']['message']}")
示例#3
0
def compile():
    if settings["download_missing_files"]:
        version = repository.Version.get_version_file()
        repo.compare_tree(version.branch) if version.commit_hash is None else repo.compare_tree(version.commit_hash)
    locales.adv_print("BUILDING")
    subprocess.check_call(["gradlew.bat", "RatPoison"])
    delete_libs_folder()
    utils.kill_jdk()
    bat_file = utils.get_bat_name()
    for path in utils.search_file("java.exe"):
        if utils.verify_path(str(path)):
            java_exe = str(path)
            with open(bat_file, "r") as rFile:
                prev_lines = rFile.readlines()
            prev_lines[4] = prev_lines[4].replace("java", f"\"{java_exe}\"", 1)
            with open(bat_file, "w") as wFile:
                wFile.writelines(prev_lines)
            break
    if locales.adv_input("RANDOMIZE_FILE_NAMES_INPUT") in locales.yes:
        randomize_file_names()
    replace_bat_path()
示例#4
0
def continue_actions(new_path):
    utils.kill_jdk()
    if os.path.exists("jdk-14.0.2"):
        shutil.move("jdk-14.0.2", new_path)
    locales.adv_print("MOVING_CFGS")
    folder_name = utils.get_settings_path()
    utils.migrate_folder(f"{folder_name}/CFGS", f"{new_path}/settings/CFGS")
    locales.adv_print("MOVING_HITSOUNDS")
    utils.migrate_folder(f"{folder_name}/hitsounds",
                         f"{new_path}/settings/hitsounds")
    locales.adv_print("MOVING_NADEHELPERS")
    utils.migrate_folder(f"{folder_name}/NadeHelper",
                         f"{new_path}/settings/NadeHelper")
    locales.adv_print("MOVING_DEFAULT_SETTINGS")
    utils.migrate_default_settings(
        f"{folder_name}/", f"{new_path}/settings/CFGS/default_migration.cfg")
    os.chdir(new_path)
    return new_path
示例#5
0
def download_repo(origin_branch):
    locales.adv_print("DOWNLOADING_NEW_VERSION")
    version = repo.get_version(origin_branch).version
    new_path = f"{settings.repository_name} {version}"
    if os.path.exists(new_path):
        if locales.adv_input("FOLDER_ALREADY_EXIST_INPUT",
                             {"new_path": new_path}) in YES:
            utils.rmtree(new_path)
        locales.adv_print("FOLDER_DELETED")
    repo.clone(origin_branch)
    locales.adv_print("DOWNLOADING_FINISHED")
    return new_path
示例#6
0
def detect_win():
    if get_win_ver() != WIN_10:
        locales.adv_print("OUTDATED_WINVER_WARNING")
示例#7
0
                 if generated_folder_path == "": raise Exception(
                     "RatPoison folder was not found")
             if settings["update_type"] == "call_installer":
                 subprocess.check_call(
                     f"{generated_folder_path}/{executing}.exe --cd=True --path=\"{generated_folder_path}\"")
                 exit(0)
             else:
                 run_continue_update_loop(generated_folder_path)
         elif not settings["force_cheat_compile"]:
             utils.ask_start_cheat()
     elif not builded or settings["force_cheat_compile"]:
         compile_tools.compile()
         utils.ask_start_cheat()
 else:
     if utils.test_internet_connection():
         locales.adv_print("CONNECTING_TO_GITHUB")
         branches = repo.get_branches()
         questions = [
             {
                 'type': 'list',
                 'name': 'branch',
                 'message': locales.message("BRANCH_TO_DOWNLOAD"),
                 'choices': list(branches)
             }
         ]
         answers = whaaaaat.prompt(questions)
         raw_branch = answers.get('branch')
         commit_hash = branches[raw_branch]["sha"]
         branch = raw_branch.split()[0]
         version = repo.get_version(branch).version
         new_dir = f"{repo.repository_name} {version}"
示例#8
0
import atexit
import locales
import os
import settingsTools
import traceback
import utils
from whaaaaat import print_json

settings = settingsTools.load_settings()
locales = locales.Locales()

can_continue = True
if os.environ["TEMP"] in os.getcwd():
    locales.adv_print("TEMP_FOLDER_EXIT")
    can_continue = False


def on_exit():
    utils.kill_jdk()


atexit.register(on_exit)
# Crash handler
if can_continue:
    try:
        import main
    except BaseException:
        print(
            "Some exception occured, please report in discord (https://discord.gg/xkTteTM):"
        )
        print("----CUT HERE----")