tool4make jar's list move to project... again

This commit is contained in:
Alexander Popov 2022-06-03 15:40:55 +03:00
parent 8ebd834e73
commit 6136fee405
Signed by: iiiypuk
GPG Key ID: 3F76816AEE08F908
3 changed files with 76 additions and 18 deletions

View File

@ -1,24 +1,15 @@
# Minecraft [Java Edition] Batch Launcher # Minecraft [Java Edition] Batch Launcher
[![Download this](https://img.shields.io/badge/Download-this-lightgrey?style=for-the-badge)](https://github.com/iiiypuk/minecraft-launcher/releases/latest) [![Support me](https://img.shields.io/badge/Support-me-ff4646?style=for-the-badge)](https://ko-fi.com/iiiypuk) [![Contact me](https://img.shields.io/badge/Contact-me-blue?style=for-the-badge)](https://t.me/slexbc) **Features:**
## Features:
* 📋 Open source. Just launch the game, nothing more * 📋 Open source. Just launch the game, nothing more
* 🏷️ Change player name * 🏷️ Change player name
* 🧰 No need for extra deps * 🧰 No need for extra deps
* ⚙️ No configuration required * ⚙️ No configuration required
![License](https://img.shields.io/github/license/iiiypuk/minecraft-launcher?style=for-the-badge) ![Latest release](https://img.shields.io/github/v/release/iiiypuk/minecraft-launcher?style=for-the-badge) ![Total downloads](https://img.shields.io/github/downloads/iiiypuk/minecraft-launcher/total?style=for-the-badge)
## Minecraft Natives ## Minecraft Natives
The natives catalog is located on [Mega.nz](https://mega.nz/#F!hUNg0Y6I!93cYw1NZg4MUWUHaVrCO7w). The natives catalog is located on [Mega.nz](https://mega.nz/#F!hUNg0Y6I!93cYw1NZg4MUWUHaVrCO7w).
**Notes:**
- Natives for `1.16.3` identical for `1.16.4`.
## TODO
See [TODO.md](TODO.md).
## ChangeLog ## ChangeLog
See [CHANGELOG.md](CHANGELOG.md). See [CHANGELOG.md](CHANGELOG.md).

View File

@ -1,8 +0,0 @@
## TODO
- [ ] Script for automatic make release **zip**
- [ ] Make binary archives with this launcher for vanilla and forge version
## Complete
- [x] Move docs to `gh-pages`
- [x] Реализовать параметр вывода в файл [[b38e3ca](https://github.com/iiiypuk/minecraft-launcher/commit/b38e3ca913ece59809cd98c65bf29d7cdb08750e)]
- [x] Исправить автоматический выхлоп для Windows, либо сделать оповещение об этом [[1ecc7be](https://github.com/iiiypuk/minecraft-launcher/commit/1ecc7be9ce5e074b0fa920efa9480502dba34e3a)]

75
tools/make_libs.py Normal file
View File

@ -0,0 +1,75 @@
#!/usr/bin/env python3
## Requirements PIP: click
"""Parse Minecraft version.json file and return using libs"""
__version__ = "1.0.5"
import sys
import json
import click
@click.command()
@click.option("-p", "--platform", default=sys.platform, help="Output platform (win32, linux, darwin).")
@click.option("-o", "--output", default="tty", help="Output option (tty, txt).")
def make_output(platform, output):
"""Return libraries list"""
libraries = parse_libs()
# OS libs separate
_ = {"win32": ";", "linux": ":", "darwin": ":"}
out_lib = str()
# Generate libraries list
for lib in libraries:
out_lib = out_lib + "$MC_DIR/libraries/{0}".format(lib) + _[platform]
out_lib = out_lib + "$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar"
# Replace for OS shell variable symbol
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 == "win32":
print("\nWindows generate libraries list complete!")
elif platform in ("linux", "darwin"):
print("\nUnix generate libraries list complete!")
elif output == "txt":
with open("./libs.txt", "w", encoding="utf-8") as f:
f.write(out_lib)
if platform == "win32":
print("\nWindows generate libraries list complete!\n" "See libs.txt file.")
elif platform in ("linux", "darwin"):
print("\nUnix generate libraries list complete!\n" "See libs.txt file.")
def parse_libs():
"""Make libraries list from version.json file"""
_ = []
try:
with open("./version.json", "r", encoding="utf-8") as f:
file_data = json.loads(f.read())
for lib in file_data["libraries"]:
_.append(lib["downloads"]["artifact"]["path"])
except FileNotFoundError:
print("ERROR: File version.json not found.")
sys.exit(-1)
return _
if __name__ == "__main__":
# pylint: disable=no-value-for-parameter
make_output()