use black for code

This commit is contained in:
Alexander Popov 2020-10-05 03:19:23 +03:00
parent a9a64937fe
commit 713c80e6ef
2 changed files with 16 additions and 31 deletions

View File

@ -7,7 +7,7 @@ Minecraft Java Edition Batch Launcher
* No need for extra deps * No need for extra deps
* Change player name * Change player name
### Instaling | Установка: ### Instaling ∙ ∙ Установка:
+ [English help](https://github.com/IIIypuk/minecraft-launcher/blob/master/INSTALLATION_EN.md) + [English help](https://github.com/IIIypuk/minecraft-launcher/blob/master/INSTALLATION_EN.md)
+ [Русская справка](https://github.com/IIIypuk/minecraft-launcher/blob/master/INSTALLATION_RU.md) + [Русская справка](https://github.com/IIIypuk/minecraft-launcher/blob/master/INSTALLATION_RU.md)

View File

@ -1,47 +1,32 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""
Script for generate Minecraft *.jar libraries
from version.json file.
usage^
$ ./make_libs.py > libs.txt
for windows need replace `$MC_DIR` to `%MC_DIR%`
and `:` to `;`
"""
import json import json
import click import click
__author__ = 'Alexander Popov' __author__ = "Alexander Popov"
__version__ = '1.0.0' __version__ = "1.0.0"
__license__ = 'Unlicense' __license__ = "Unlicense"
@click.command() @click.command()
@click.option('--platform', default='win', @click.option("--platform", default="win", help="Output platform (win, unix).")
help='Output platform (win, unix).')
def make_output(platform): def make_output(platform):
""" Return libraries list """ """ Return libraries list """
libraries = parse_libs() libraries = parse_libs()
_ = { _ = {"win": ";", "unix": ":"}
'win': ';',
'unix': ':'
}
output = str() output = str()
for lib in libraries: for lib in libraries:
output = output + '$MC_DIR/libraries/{0}'.format(lib) + _[platform] output = output + "$MC_DIR/libraries/{0}".format(lib) + _[platform]
output = output + '$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar' output = output + "$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar"
if platform == 'win': if platform == "win":
output = output.replace('$MC_DIR', '%MC_DIR%') output = output.replace("$MC_DIR", "%MC_DIR%")
output = output.replace('$GAME_VERSION', '%GAME_VERSION%') output = output.replace("$GAME_VERSION", "%GAME_VERSION%")
click.echo(output) click.echo(output)
@ -51,14 +36,14 @@ def parse_libs():
_ = [] _ = []
with open('./version.json', 'r', encoding='utf-8') as f: with open("./version.json", "r", encoding="utf-8") as f:
file_data = json.loads(f.read()) file_data = json.loads(f.read())
for lib in file_data['libraries']: for lib in file_data["libraries"]:
_.append(lib['downloads']['artifact']['path']) _.append(lib["downloads"]["artifact"]["path"])
return(_) return _
if __name__ == '__main__': if __name__ == "__main__":
make_output() make_output()