Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/generate-manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Generate Manifest

on:
push:
paths-ignore:
- '.gitattributes'
- '.gitignore'
- 'LICENSE'
- 'README.md'
workflow_dispatch:
release:
types: [published]

jobs:
generate-manifest:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Generate manifest.json
run: |
python3 << 'EOF'
import os
import sys

from Scripts import integrity_checker
from Scripts import utils

checker = integrity_checker.IntegrityChecker()

root_folder = os.getcwd()
manifest_path = os.path.join(root_folder, "manifest.json")

print(f"Generating manifest from: {root_folder}")
manifest_data = checker.generate_folder_manifest(root_folder, manifest_path)

if manifest_data:
print(f"Manifest generated successfully with {len(manifest_data)} files")
else:
print("Failed to generate manifest")
sys.exit(1)
EOF

- name: Upload manifest.json to Artifacts
uses: actions/upload-artifact@v4
with:
name: manifest.json
path: ./manifest.json
47 changes: 47 additions & 0 deletions OpCore-Simplify.bat
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,56 @@ if /i "!just_installing!" == "TRUE" (
)
exit /b

:checkrequirements
REM Check and install Python requirements
set "requirements_file=!thisDir!requirements.txt"
if not exist "!requirements_file!" (
echo Warning: requirements.txt not found. Skipping dependency check.
exit /b 0
)
echo Checking Python dependencies...
"!pypath!" -m pip --version > nul 2>&1
set "pip_check_error=!ERRORLEVEL!"
if not "!pip_check_error!" == "0" (
echo Warning: pip is not available. Attempting to install pip...
"!pypath!" -m ensurepip --upgrade > nul 2>&1
set "ensurepip_error=!ERRORLEVEL!"
if not "!ensurepip_error!" == "0" (
echo Error: Could not install pip. Please install pip manually.
exit /b 1
)
)
REM Try to import key packages to check if they're installed
"!pypath!" -c "import PyQt6; import qfluentwidgets" > nul 2>&1
set "import_check_error=!ERRORLEVEL!"
if not "!import_check_error!" == "0" (
echo Installing required packages from requirements.txt...
"!pypath!" -m pip install --upgrade -r "!requirements_file!"
set "pip_install_error=!ERRORLEVEL!"
if not "!pip_install_error!" == "0" (
echo.
echo Error: Failed to install requirements. Please install them manually:
echo !pypath! -m pip install -r !requirements_file!
echo.
echo Press [enter] to exit...
pause > nul
exit /b 1
)
echo Requirements installed successfully.
) else (
echo All requirements are already installed.
)
exit /b 0

:runscript
REM Python found
cls
REM Check and install requirements before running the script
call :checkrequirements
set "req_check_error=!ERRORLEVEL!"
if not "!req_check_error!" == "0" (
exit /b 1
)
set "args=%*"
set "args=!args:"=!"
if "!args!"=="" (
Expand Down
41 changes: 41 additions & 0 deletions OpCore-Simplify.command
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,42 @@ prompt_and_download() {
done
}

check_and_install_requirements() {
local python="$1"
local requirements_file="$dir/requirements.txt"

# Check if requirements.txt exists
if [ ! -f "$requirements_file" ]; then
echo "Warning: requirements.txt not found. Skipping dependency check."
return 0
fi

# Check if pip is available
if ! "$python" -m pip --version > /dev/null 2>&1; then
echo "Warning: pip is not available. Attempting to install pip..."
if ! "$python" -m ensurepip --upgrade > /dev/null 2>&1; then
echo "Error: Could not install pip. Please install pip manually."
return 1
fi
fi

# Check if requirements are installed by trying to import key packages
echo "Checking Python dependencies..."
if ! "$python" -c "import PyQt6; import qfluentwidgets" > /dev/null 2>&1; then
echo "Installing required packages from requirements.txt..."
if ! "$python" -m pip install --upgrade -r "$requirements_file"; then
echo "Error: Failed to install requirements. Please install them manually:"
echo " $python -m pip install -r $requirements_file"
return 1
fi
echo "Requirements installed successfully."
else
echo "All requirements are already installed."
fi

return 0
}

main() {
local python= version=
# Verify our target exists
Expand Down Expand Up @@ -310,6 +346,11 @@ main() {
prompt_and_download
return 1
fi
# Check and install requirements before running the script
if ! check_and_install_requirements "$python"; then
echo "Failed to install requirements. Exiting."
exit 1
fi
# Found it - start our script and pass all args
"$python" "$dir/$target" "${args[@]}"
}
Expand Down
Loading