mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
Merge pull request #68 from KeksPirates/fix/remove-aiohttp
Sync README dependencies with requirements and update workflows
This commit is contained in:
@@ -248,4 +248,4 @@ jobs:
|
|||||||
release/SoftwareManager-stable-${{ needs.build.outputs.short_sha }}-macos
|
release/SoftwareManager-stable-${{ needs.build.outputs.short_sha }}-macos
|
||||||
release/SHA256SUMS.txt
|
release/SHA256SUMS.txt
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
name: Sync README Dependencies
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- requirements.txt
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
|
||||||
|
- name: Update README dependencies
|
||||||
|
run: python scripts/sync_readme_dependencies.py
|
||||||
|
|
||||||
|
- name: Create pull request
|
||||||
|
uses: peter-evans/create-pull-request@v7
|
||||||
|
with:
|
||||||
|
commit-message: "Sync README dependencies"
|
||||||
|
branch: auto/sync-readme-dependencies
|
||||||
|
title: "Sync README dependencies"
|
||||||
|
body: "Automated update of the Python Dependencies section in README.md to match `requirements.txt`."
|
||||||
|
labels: documentation
|
||||||
@@ -35,19 +35,20 @@ SoftwareManager is a Python-based GUI tool that simplifies searching and downloa
|
|||||||
## Python Dependencies
|
## Python Dependencies
|
||||||
(also included in requirements.txt)
|
(also included in requirements.txt)
|
||||||
|
|
||||||
```bash
|
<!-- python-dependencies:start -->
|
||||||
|
```text
|
||||||
requests (2.32.2)
|
requests (2.32.2)
|
||||||
PySide6 (6.10.1)
|
PySide6-Essentials (6.10.1)
|
||||||
beautifulsoup (44.13.5)
|
beautifulsoup4 (4.13.5)
|
||||||
darkdetect (0.7.1)
|
darkdetect (0.7.1)
|
||||||
pyinstaller (6.15.0)
|
pyinstaller (6.15.0)
|
||||||
PyQtDarkTheme-fork (2.3.4)
|
PyQtDarkTheme-fork (2.3.4)
|
||||||
aiohttp (3.13.0)
|
|
||||||
plyer (2.1.0)
|
plyer (2.1.0)
|
||||||
psutil (7.1.0)
|
psutil (7.1.0)
|
||||||
libtorrent (2.0.11)
|
libtorrent (2.0.11)
|
||||||
libtorrent-windows-dll (0.0.3)
|
libtorrent-windows-dll (0.0.3)
|
||||||
```
|
```
|
||||||
|
<!-- python-dependencies:end -->
|
||||||
|
|
||||||
## Activity
|
## Activity
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ beautifulsoup4==4.13.5
|
|||||||
darkdetect==0.7.1
|
darkdetect==0.7.1
|
||||||
pyinstaller==6.15.0
|
pyinstaller==6.15.0
|
||||||
PyQtDarkTheme-fork==2.3.4
|
PyQtDarkTheme-fork==2.3.4
|
||||||
aiohttp==3.13.0
|
|
||||||
plyer==2.1.0
|
plyer==2.1.0
|
||||||
psutil==7.1.0
|
psutil==7.1.0
|
||||||
libtorrent==2.0.11
|
libtorrent==2.0.11
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
ROOT_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
README_PATH = ROOT_DIR / "README.md"
|
||||||
|
REQUIREMENTS_PATH = ROOT_DIR / "requirements.txt"
|
||||||
|
|
||||||
|
START_MARKER = "<!-- python-dependencies:start -->"
|
||||||
|
END_MARKER = "<!-- python-dependencies:end -->"
|
||||||
|
REQUIREMENT_PATTERN = re.compile(
|
||||||
|
r"^(?P<name>[A-Za-z0-9_.\-\[\]]+)\s*(?P<specifier>(==|~=|>=|<=|!=|>|<).+)?$"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def iter_requirements(requirements_text: str) -> list[str]:
|
||||||
|
formatted_lines: list[str] = []
|
||||||
|
|
||||||
|
for raw_line in requirements_text.splitlines():
|
||||||
|
line = raw_line.strip()
|
||||||
|
if not line or line.startswith("#"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
match = REQUIREMENT_PATTERN.match(line)
|
||||||
|
if not match:
|
||||||
|
formatted_lines.append(f" {line}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
name = match.group("name")
|
||||||
|
specifier = (match.group("specifier") or "").strip()
|
||||||
|
|
||||||
|
if specifier.startswith("=="):
|
||||||
|
formatted_lines.append(f" {name} ({specifier[2:]})")
|
||||||
|
elif specifier:
|
||||||
|
formatted_lines.append(f" {name} {specifier}")
|
||||||
|
else:
|
||||||
|
formatted_lines.append(f" {name}")
|
||||||
|
|
||||||
|
return formatted_lines
|
||||||
|
|
||||||
|
|
||||||
|
def render_dependency_block(requirements_text: str) -> str:
|
||||||
|
dependency_lines = iter_requirements(requirements_text)
|
||||||
|
return "\n".join(
|
||||||
|
[
|
||||||
|
START_MARKER,
|
||||||
|
" ```text",
|
||||||
|
*dependency_lines,
|
||||||
|
" ```",
|
||||||
|
END_MARKER,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def replace_managed_block(readme_text: str, rendered_block: str) -> str:
|
||||||
|
start_index = readme_text.find(START_MARKER)
|
||||||
|
end_index = readme_text.find(END_MARKER)
|
||||||
|
|
||||||
|
if start_index == -1 or end_index == -1 or end_index < start_index:
|
||||||
|
raise RuntimeError("README dependency markers are missing or invalid.")
|
||||||
|
|
||||||
|
end_index += len(END_MARKER)
|
||||||
|
return readme_text[:start_index] + rendered_block + readme_text[end_index:]
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
requirements_text = REQUIREMENTS_PATH.read_text(encoding="utf-8")
|
||||||
|
readme_text = README_PATH.read_text(encoding="utf-8")
|
||||||
|
rendered_block = render_dependency_block(requirements_text)
|
||||||
|
updated_readme = replace_managed_block(readme_text, rendered_block)
|
||||||
|
|
||||||
|
if updated_readme != readme_text:
|
||||||
|
README_PATH.write_text(updated_readme, encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user