mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-06-10 06:14:36 +00:00
Fix reviews
This commit is contained in:
74
build.bat
Normal file → Executable file
74
build.bat
Normal file → Executable file
@@ -1,37 +1,37 @@
|
||||
@echo off
|
||||
|
||||
REM Get the directory path of the script
|
||||
set "dirpath=%~dp0"
|
||||
if "%dirpath:~-1%" == "\" set "dirpath=%dirpath:~0,-1%"
|
||||
|
||||
REM Check if the virtual environment exists
|
||||
if not exist "%dirpath%\env" (
|
||||
echo:
|
||||
echo No virtual environment found! Run setup_env.bat to set it up first.
|
||||
echo:
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
|
||||
REM Check if pyinstaller and pywin32 is installed in the virtual environment
|
||||
if not exist "%dirpath%\env\scripts\pyinstaller.exe" (
|
||||
"%dirpath%\env\scripts\pip" install pyinstaller
|
||||
if errorlevel 1 (
|
||||
echo Failed to install pyinstaller.
|
||||
exit /b 1
|
||||
)
|
||||
"%dirpath%\env\scripts\python" "%dirpath%\env\scripts\pywin32_postinstall.py" -install -silent
|
||||
if errorlevel 1 (
|
||||
echo Failed to run pywin32_postinstall.py.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Run pyinstaller with the specified build spec file
|
||||
"%dirpath%\env\scripts\pyinstaller" "%dirpath%\build.spec"
|
||||
if errorlevel 1 (
|
||||
echo PyInstaller build failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Build completed successfully.
|
||||
@echo off
|
||||
|
||||
REM Get the directory path of the script
|
||||
set "dirpath=%~dp0"
|
||||
if "%dirpath:~-1%" == "\" set "dirpath=%dirpath:~0,-1%"
|
||||
|
||||
REM Check if the virtual environment exists
|
||||
if not exist "%dirpath%\env" (
|
||||
echo:
|
||||
echo No virtual environment found! Run setup_env.bat to set it up first.
|
||||
echo:
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Check if pyinstaller and pywin32 is installed in the virtual environment
|
||||
if not exist "%dirpath%\env\scripts\pyinstaller.exe" (
|
||||
"%dirpath%\env\scripts\pip" install pyinstaller
|
||||
if errorlevel 1 (
|
||||
echo Failed to install pyinstaller.
|
||||
exit /b 1
|
||||
)
|
||||
"%dirpath%\env\scripts\python" "%dirpath%\env\scripts\pywin32_postinstall.py" -install -silent
|
||||
if errorlevel 1 (
|
||||
echo Failed to run pywin32_postinstall.py.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Run pyinstaller with the specified build spec file
|
||||
"%dirpath%\env\scripts\pyinstaller" "%dirpath%\build.spec"
|
||||
if errorlevel 1 (
|
||||
echo PyInstaller build failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Build completed successfully.
|
||||
|
||||
2
build.sh
2
build.sh
@@ -33,4 +33,4 @@ fi
|
||||
|
||||
echo
|
||||
echo "Build completed successfully."
|
||||
read -p "Press any key to continue..."
|
||||
read -p "Press any key to continue..."
|
||||
|
||||
234
build.spec
Normal file → Executable file
234
build.spec
Normal file → Executable file
@@ -1,117 +1,117 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, TYPE_CHECKING
|
||||
import platform
|
||||
|
||||
SELF_PATH = str(Path(".").resolve())
|
||||
if SELF_PATH not in sys.path:
|
||||
sys.path.insert(0, SELF_PATH)
|
||||
|
||||
from constants import WORKING_DIR, SITE_PACKAGES_PATH, DEFAULT_LANG
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PyInstaller.building.api import PYZ, EXE
|
||||
from PyInstaller.building.build_main import Analysis
|
||||
|
||||
# (source_path, dest_path, required)
|
||||
to_add: list[tuple[Path, str, bool]] = [
|
||||
# icon files
|
||||
(Path("icons/pickaxe.ico"), "./icons", True),
|
||||
(Path("icons/active.ico"), "./icons", True),
|
||||
(Path("icons/idle.ico"), "./icons", True),
|
||||
(Path("icons/error.ico"), "./icons", True),
|
||||
(Path("icons/maint.ico"), "./icons", True),
|
||||
# SeleniumWire HTTPS/SSL cert file and key
|
||||
(Path(SITE_PACKAGES_PATH, "seleniumwire/ca.crt"), "./seleniumwire", False),
|
||||
(Path(SITE_PACKAGES_PATH, "seleniumwire/ca.key"), "./seleniumwire", False),
|
||||
]
|
||||
for lang_filepath in WORKING_DIR.joinpath("lang").glob("*.json"):
|
||||
if lang_filepath.stem != DEFAULT_LANG:
|
||||
to_add.append((lang_filepath, "lang", True))
|
||||
|
||||
# Ensure the required to-be-added data exists
|
||||
datas: list[tuple[Path, str]] = []
|
||||
for source_path, dest_path, required in to_add:
|
||||
if source_path.exists():
|
||||
datas.append((source_path, dest_path))
|
||||
elif required:
|
||||
raise FileNotFoundError(str(source_path))
|
||||
|
||||
hooksconfig: dict[str, Any] = {}
|
||||
binaries: list[tuple[Path, str]] = []
|
||||
hiddenimports: list[str] = [
|
||||
"PIL._tkinter_finder",
|
||||
"setuptools._distutils.log",
|
||||
"setuptools._distutils.dir_util",
|
||||
"setuptools._distutils.file_util",
|
||||
"setuptools._distutils.archive_util",
|
||||
]
|
||||
|
||||
if sys.platform == "linux":
|
||||
# Needed files for better system tray support on Linux via pystray (AppIndicator backend).
|
||||
arch = platform.machine()
|
||||
datas.append((Path(f"/usr/lib/{arch}-linux-gnu/girepository-1.0/AyatanaAppIndicator3-0.1.typelib"), "gi_typelibs"))
|
||||
binaries.append((Path(f"/usr/lib/{arch}-linux-gnu/libayatana-appindicator3.so.1"), "."))
|
||||
|
||||
hiddenimports.extend([
|
||||
"gi.repository.Gtk",
|
||||
"gi.repository.GObject",
|
||||
])
|
||||
hooksconfig = {
|
||||
"gi": {
|
||||
"icons": [],
|
||||
"themes": [],
|
||||
"languages": ["en_US"]
|
||||
}
|
||||
}
|
||||
|
||||
block_cipher = None
|
||||
a = Analysis(
|
||||
["main.py"],
|
||||
pathex=[],
|
||||
datas=datas,
|
||||
excludes=[],
|
||||
hookspath=[],
|
||||
noarchive=False,
|
||||
runtime_hooks=[],
|
||||
binaries=binaries,
|
||||
cipher=block_cipher,
|
||||
hooksconfig=hooksconfig,
|
||||
hiddenimports=hiddenimports,
|
||||
win_private_assemblies=False,
|
||||
win_no_prefer_redirects=False,
|
||||
)
|
||||
|
||||
# Exclude unneeded Linux libraries
|
||||
excluded_binaries = [
|
||||
"libicudata.so.66",
|
||||
"libicuuc.so.66",
|
||||
"librsvg-2.so.2"
|
||||
]
|
||||
a.binaries = [b for b in a.binaries if b[0] not in excluded_binaries]
|
||||
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
upx=True,
|
||||
debug=False,
|
||||
strip=False,
|
||||
console=False,
|
||||
upx_exclude=[],
|
||||
target_arch=None,
|
||||
runtime_tmpdir=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon="icons/pickaxe.ico",
|
||||
bootloader_ignore_signals=False,
|
||||
disable_windowed_traceback=False,
|
||||
name="Twitch Drops Miner (by DevilXD)",
|
||||
)
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import platform
|
||||
from pathlib import Path
|
||||
from typing import Any, TYPE_CHECKING
|
||||
|
||||
SELF_PATH = str(Path(".").resolve())
|
||||
if SELF_PATH not in sys.path:
|
||||
sys.path.insert(0, SELF_PATH)
|
||||
|
||||
from constants import WORKING_DIR, SITE_PACKAGES_PATH, DEFAULT_LANG
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from PyInstaller.building.api import PYZ, EXE
|
||||
from PyInstaller.building.build_main import Analysis
|
||||
|
||||
# (source_path, dest_path, required)
|
||||
to_add: list[tuple[Path, str, bool]] = [
|
||||
# icon files
|
||||
(Path("icons/pickaxe.ico"), "./icons", True),
|
||||
(Path("icons/active.ico"), "./icons", True),
|
||||
(Path("icons/idle.ico"), "./icons", True),
|
||||
(Path("icons/error.ico"), "./icons", True),
|
||||
(Path("icons/maint.ico"), "./icons", True),
|
||||
# SeleniumWire HTTPS/SSL cert file and key
|
||||
(Path(SITE_PACKAGES_PATH, "seleniumwire/ca.crt"), "./seleniumwire", False),
|
||||
(Path(SITE_PACKAGES_PATH, "seleniumwire/ca.key"), "./seleniumwire", False),
|
||||
]
|
||||
for lang_filepath in WORKING_DIR.joinpath("lang").glob("*.json"):
|
||||
if lang_filepath.stem != DEFAULT_LANG:
|
||||
to_add.append((lang_filepath, "lang", True))
|
||||
|
||||
# Ensure the required to-be-added data exists
|
||||
datas: list[tuple[Path, str]] = []
|
||||
for source_path, dest_path, required in to_add:
|
||||
if source_path.exists():
|
||||
datas.append((source_path, dest_path))
|
||||
elif required:
|
||||
raise FileNotFoundError(str(source_path))
|
||||
|
||||
hooksconfig: dict[str, Any] = {}
|
||||
binaries: list[tuple[Path, str]] = []
|
||||
hiddenimports: list[str] = [
|
||||
"PIL._tkinter_finder",
|
||||
"setuptools._distutils.log",
|
||||
"setuptools._distutils.dir_util",
|
||||
"setuptools._distutils.file_util",
|
||||
"setuptools._distutils.archive_util",
|
||||
]
|
||||
|
||||
if sys.platform == "linux":
|
||||
# Needed files for better system tray support on Linux via pystray (AppIndicator backend).
|
||||
arch = platform.machine()
|
||||
datas.append((Path(f"/usr/lib/{arch}-linux-gnu/girepository-1.0/AyatanaAppIndicator3-0.1.typelib"), "gi_typelibs"))
|
||||
binaries.append((Path(f"/usr/lib/{arch}-linux-gnu/libayatana-appindicator3.so.1"), "."))
|
||||
|
||||
hiddenimports.extend([
|
||||
"gi.repository.Gtk",
|
||||
"gi.repository.GObject",
|
||||
])
|
||||
hooksconfig = {
|
||||
"gi": {
|
||||
"icons": [],
|
||||
"themes": [],
|
||||
"languages": ["en_US"]
|
||||
}
|
||||
}
|
||||
|
||||
block_cipher = None
|
||||
a = Analysis(
|
||||
["main.py"],
|
||||
pathex=[],
|
||||
datas=datas,
|
||||
excludes=[],
|
||||
hookspath=[],
|
||||
noarchive=False,
|
||||
runtime_hooks=[],
|
||||
binaries=binaries,
|
||||
cipher=block_cipher,
|
||||
hooksconfig=hooksconfig,
|
||||
hiddenimports=hiddenimports,
|
||||
win_private_assemblies=False,
|
||||
win_no_prefer_redirects=False,
|
||||
)
|
||||
|
||||
# Exclude unneeded Linux libraries
|
||||
excluded_binaries = [
|
||||
"libicudata.so.66",
|
||||
"libicuuc.so.66",
|
||||
"librsvg-2.so.2"
|
||||
]
|
||||
a.binaries = [b for b in a.binaries if b[0] not in excluded_binaries]
|
||||
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
upx=True,
|
||||
debug=False,
|
||||
strip=False,
|
||||
console=False,
|
||||
upx_exclude=[],
|
||||
target_arch=None,
|
||||
runtime_tmpdir=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon="icons/pickaxe.ico",
|
||||
bootloader_ignore_signals=False,
|
||||
disable_windowed_traceback=False,
|
||||
name="Twitch Drops Miner (by DevilXD)",
|
||||
)
|
||||
|
||||
100
setup_env.bat
Normal file → Executable file
100
setup_env.bat
Normal file → Executable file
@@ -1,54 +1,46 @@
|
||||
@echo off
|
||||
|
||||
REM Get the directory path of the script
|
||||
set "dirpath=%~dp0"
|
||||
if "%dirpath:~-1%" == "\" set "dirpath=%dirpath:~0,-1%"
|
||||
|
||||
REM Check if git is installed
|
||||
git --version > nul 2>&1
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo No git executable found in PATH!
|
||||
echo:
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Create the virtual environment if it doesn't exist
|
||||
if not exist "%dirpath%\env" (
|
||||
echo:
|
||||
echo Creating the env folder...
|
||||
python -m venv "%dirpath%\env"
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo:
|
||||
echo No python executable found in PATH or failed to create virtual environment!
|
||||
echo:
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Activate the virtual environment and install requirements
|
||||
echo:
|
||||
echo Installing requirements.txt...
|
||||
"%dirpath%\env\scripts\python" -m pip install -U pip
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo Failed to upgrade pip.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
"%dirpath%\env\scripts\pip" install wheel
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo Failed to install wheel.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
"%dirpath%\env\scripts\pip" install -r "%dirpath%\requirements.txt"
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo Failed to install requirements.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo:
|
||||
echo All done!
|
||||
echo:
|
||||
pause
|
||||
@echo off
|
||||
|
||||
REM Get the directory path of the script
|
||||
set "dirpath=%~dp0"
|
||||
if "%dirpath:~-1%" == "\" set "dirpath=%dirpath:~0,-1%"
|
||||
|
||||
REM Check if git is installed
|
||||
git --version > nul 2>&1
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo No git executable found in PATH!
|
||||
echo:
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Create the virtual environment if it doesn't exist
|
||||
if not exist "%dirpath%\env" (
|
||||
echo:
|
||||
echo Creating the env folder...
|
||||
python -m venv "%dirpath%\env"
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo:
|
||||
echo No python executable found in PATH or failed to create virtual environment!
|
||||
echo:
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Activate the virtual environment and install requirements
|
||||
echo:
|
||||
echo Installing requirements.txt...
|
||||
"%dirpath%\env\scripts\python" -m pip install -U pip
|
||||
|
||||
"%dirpath%\env\scripts\pip" install wheel
|
||||
|
||||
"%dirpath%\env\scripts\pip" install -r "%dirpath%\requirements.txt"
|
||||
if %errorlevel% NEQ 0 (
|
||||
echo Failed to install requirements.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo:
|
||||
echo All done!
|
||||
echo:
|
||||
pause
|
||||
|
||||
10
setup_env.sh
10
setup_env.sh
@@ -28,16 +28,8 @@ fi
|
||||
echo
|
||||
echo "Installing requirements.txt..."
|
||||
"$dirpath/env/bin/python" -m pip install -U pip
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to upgrade pip."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$dirpath/env/bin/pip" install wheel
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to install wheel."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$dirpath/env/bin/pip" install -r "$dirpath/requirements.txt"
|
||||
if [ $? -ne 0 ]; then
|
||||
@@ -48,4 +40,4 @@ fi
|
||||
echo
|
||||
echo "All done!"
|
||||
echo
|
||||
read -p "Press any key to continue..."
|
||||
read -p "Press any key to continue..."
|
||||
|
||||
Reference in New Issue
Block a user