From 219bc5ba5c71152252b760927c031638334ca048 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sat, 17 Oct 2020 00:26:41 +0300 Subject: [PATCH] auto select output platform --- tools/make_libs_list.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) mode change 100644 => 100755 tools/make_libs_list.py diff --git a/tools/make_libs_list.py b/tools/make_libs_list.py old mode 100644 new mode 100755 index 8a5a488..cf76604 --- a/tools/make_libs_list.py +++ b/tools/make_libs_list.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import sys import json import click @@ -9,7 +10,7 @@ __license__ = "Unlicense" @click.command() -@click.option("--platform", default="win", help="Output platform (win, unix).") +@click.option("--platform", default=sys.platform, help="Output platform (win32, linux, darwin).") @click.option("--output", default="tty", help="Output option (tty, txt).") def make_output(platform, output): """ Return libraries list """ @@ -17,7 +18,7 @@ def make_output(platform, output): libraries = parse_libs() # OS libs separate - _ = {"win": ";", "unix": ":"} + _ = {"win": ";", "linux": ":", "darwin": ":"} out_lib = str() @@ -28,24 +29,24 @@ def make_output(platform, output): out_lib = out_lib + "$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar" # Replace for OS shell variable symbol - if platform == "win": + if platform == "win32": out_lib = out_lib.replace("$MC_DIR", "%MC_DIR%") out_lib = out_lib.replace("$GAME_VERSION", "%GAME_VERSION%") if output == "tty": click.echo(out_lib) - if platform == "win": + if platform == "win32": print("\nWindows generate libraries list complete!") - elif platform == "unix": + elif platform == "linux" or platform == "darwin": print("\nLinux generate libraries list complete!") elif output == "txt": with open("./libs.txt", "w", encoding="utf-8") as f: f.write(out_lib) - if platform == "win": + if platform == "win32": print("\nWindows generate libraries list complete!\n" "See libs.txt file.") - elif platform == "unix": + elif platform == "linux" or platform == "darwin": print("\nLinux generate libraries list complete!\n" "See libs.txt file.")