From c7e87bc16a6e0bbe1b04ee07c910b2a768809601 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sat, 22 Jan 2022 20:35:30 +0100 Subject: [PATCH] Setup: add setup specific requirements --- FactorioClient.py | 4 ++-- ModuleUpdate.py | 6 +++--- setup.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/FactorioClient.py b/FactorioClient.py index d3378796290d..825e105261f2 100644 --- a/FactorioClient.py +++ b/FactorioClient.py @@ -308,8 +308,8 @@ async def main(args): if sys.stdin: input_task = asyncio.create_task(console_loop(ctx), name="Input") factorio_server_task = asyncio.create_task(factorio_spinup_server(ctx), name="FactorioSpinupServer") - succesful_launch = await factorio_server_task - if succesful_launch: + successful_launch = await factorio_server_task + if successful_launch: factorio_server_task = asyncio.create_task(factorio_server_watcher(ctx), name="FactorioServer") progression_watcher = asyncio.create_task( game_watcher(ctx), name="FactorioProgressionWatcher") diff --git a/ModuleUpdate.py b/ModuleUpdate.py index 77ea25998662..f075b7ccf8f0 100644 --- a/ModuleUpdate.py +++ b/ModuleUpdate.py @@ -23,7 +23,7 @@ def update_command(): subprocess.call([sys.executable, '-m', 'pip', 'install', '-r', file, '--upgrade']) -def update(yes = False, force = False): +def update(yes=False, force=False): global update_ran if not update_ran: update_ran = True @@ -38,9 +38,8 @@ def update(yes = False, force = False): for line in requirementsfile: if line.startswith('https://'): # extract name and version from url - url = line.split(';')[0] wheel = line.split('/')[-1] - name, version, _ = wheel.split('-',2) + name, version, _ = wheel.split('-', 2) line = f'{name}=={version}' requirements = pkg_resources.parse_requirements(line) for requirement in requirements: @@ -58,6 +57,7 @@ def update(yes = False, force = False): if __name__ == "__main__": import argparse + parser = argparse.ArgumentParser(description='Install archipelago requirements') parser.add_argument('-y', '--yes', dest='yes', action='store_true', help='answer "yes" to all questions') parser.add_argument('-f', '--force', dest='force', action='store_true', help='force update') diff --git a/setup.py b/setup.py index e5cda87a0552..c4b6c63b49b0 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,16 @@ import sys import sysconfig from pathlib import Path + +import ModuleUpdate +# I don't really want to have another root directory file for a single requirement, but this special case is also jank. +# Might move this into a cleaner solution when I think of one. +with open("freeze_requirements.txt", "w") as f: + f.write("cx-Freeze>=6.9\n") +ModuleUpdate.requirements_files.add("freeze_requirements.txt") +ModuleUpdate.requirements_files.add(os.path.join("WebHostLib", "requirements.txt")) +ModuleUpdate.update() + import cx_Freeze from kivy_deps import sdl2, glew from Utils import version_tuple