From 5fa585852d745f4350e7e31680e6b1d764e8d4c2 Mon Sep 17 00:00:00 2001 From: Dylan Jones Date: Sun, 6 Dec 2020 03:28:36 -0500 Subject: Prepare for pyinstaller bundling --- installer.py | 7 ++++++- modpackman.py | 8 ++++++-- modpackman.spec | 33 +++++++++++++++++++++++++++++++++ pack.ini | 4 ++-- version.txt | 2 +- 5 files changed, 48 insertions(+), 6 deletions(-) mode change 100644 => 100755 installer.py create mode 100644 modpackman.spec diff --git a/installer.py b/installer.py old mode 100644 new mode 100755 index 16e087f..deecd5b --- a/installer.py +++ b/installer.py @@ -1,5 +1,10 @@ -import subprocess import os +import sys + +if hasattr(sys, '_MEIPASS'): # we're running in a bundle, go where we have our bundled assets + os.chdir(sys._MEIPASS) + +import subprocess import requests import tempfile import shutil diff --git a/modpackman.py b/modpackman.py index 1bd28d4..503fbf3 100755 --- a/modpackman.py +++ b/modpackman.py @@ -1,7 +1,11 @@ #!/usr/bin/env python3 -import argparse import os import sys + +if hasattr(sys, '_MEIPASS'): # we're running in a bundle, go to where we have our bundled assets + os.chdir(sys._MEIPASS) + +import argparse import shutil import requests import pathlib @@ -130,7 +134,7 @@ if __name__ == "__main__": # run the command if args.command == "install": - install("version.txt", config['pack']["whitelist"], os.path.join(config['pack']['location'], 'mods')) + install() elif args.command == "apply_updates": apply_updates(config['mods'], "version.txt", config['pack']["game_version"]) elif args.command == "check_updates": diff --git a/modpackman.spec b/modpackman.spec new file mode 100644 index 0000000..382568f --- /dev/null +++ b/modpackman.spec @@ -0,0 +1,33 @@ +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None + + +a = Analysis(['modpackman.py'], + pathex=['/home/dylan/workspace/mod-manager'], + binaries=[], + datas=[('version.txt', '.'), ('pack.ini', '.'), ('local-config.ini', '.'), ('jeffrey-3-icon.png', '.')], + hiddenimports=[], + hookspath=[], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False) +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='modpackman', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True ) diff --git a/pack.ini b/pack.ini index 298f962..b5c1dbb 100644 --- a/pack.ini +++ b/pack.ini @@ -42,8 +42,8 @@ botania = https://www.curseforge.com/minecraft/mc-mods/botania jei = https://www.curseforge.com/minecraft/mc-mods/jei tetra = https://www.curseforge.com/minecraft/mc-mods/tetra # Until the PR gets merged we're downloading direct from GitHub -immersive-portals = https://github.com/DylanJones/ImmersivePortalsModForForge/releases/download/v0.9-1.16-temp/immersive-portals-0.9.jar -# immersive-portals = https://www.curseforge.com/minecraft/mc-mods/immersive-portals-for-forge/files/all +# immersive-portals = https://github.com/DylanJones/ImmersivePortalsModForForge/releases/download/v0.9-1.16-temp/immersive-portals-0.9.jar +immersive-portals = https://www.curseforge.com/minecraft/mc-mods/immersive-portals-for-forge # Smaller yes mods inventory-sorter = https://www.curseforge.com/minecraft/mc-mods/inventory-sorter diff --git a/version.txt b/version.txt index c874116..9568e87 100644 --- a/version.txt +++ b/version.txt @@ -27,7 +27,7 @@ immersive-engineering.jar a1263bd875531ee5bf70937fa207f4509efb1cfe https://media botania.jar c890bd2ec0d13ead2627b0bf0c7599de6b2f6194 https://media.forgecdn.net/files/3086/502/Botania-1.16.3-409.jar jei.jar 2bbcffbbe7ac7c93e75783637a0a78fddcb4109d https://media.forgecdn.net/files/3109/181/jei-1.16.4-7.6.0.58.jar tetra.jar 6e097ef3053cc56b95973607db632d08ebf6c554 https://media.forgecdn.net/files/3104/240/tetra-1.16.4-3.3.1.jar -immersive-portals.jar 3fc06df79a96fc9e695c3f1091772e8cd2b175cd https://github-production-release-asset-2e65be.s3.amazonaws.com/316149911/5d2ca300-2f8e-11eb-8586-1e03f0825404?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201129%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201129T065251Z&X-Amz-Expires=300&X-Amz-Signature=181cc92add82b065cda2a9988f1a4d277f66e6a1e9554ed64187006e371e4ba6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=316149911&response-content-disposition=attachment%3B%20filename%3Dimmersive-portals-0.9.jar&response-content-type=application%2Foctet-stream +immersive-portals.jar 3fc06df79a96fc9e695c3f1091772e8cd2b175cd https://github.com/DylanJones/ImmersivePortalsModForForge/releases/download/v0.9-1.16-temp/immersive-portals-0.9.jar inventory-sorter.jar fb538c5a8eb1e8a7a2bc35f3344b816634d53e4e https://media.forgecdn.net/files/3077/903/inventorysorter-1.16.1-18.1.0.jar creeper-confetti.jar c1d06621ba453680fe31dd30fe11f6ea9bcc8e93 https://media.forgecdn.net/files/3063/500/creeperconfetti-3.4.jar hwyla.jar 79123ef4c447affe57e77ee241d78c494bd8948d https://media.forgecdn.net/files/3033/593/Hwyla-forge-1.10.11-B78_1.16.2.jar -- cgit v1.2.3