diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 01d349e..667f6b1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,9 +3,6 @@ on: push: -permissions: - contents: write - concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -81,6 +78,8 @@ upload: name: Upload Release Assets + permissions: + contents: write needs: - build-pkg - build-exe diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5f5b122..1a80ef9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,16 +5,15 @@ branches: - main -permissions: - contents: write - pull-requests: write - concurrency: group: ${{ github.workflow }}-${{ github.ref }} jobs: release: name: Create GitHub Release + permissions: + contents: write + pull-requests: write runs-on: ubuntu-latest outputs: created: ${{ steps.release.outputs.releases_created }} @@ -130,6 +129,8 @@ upload: name: Upload Release Assets + permissions: + contents: write needs: - release - build-pkg diff --git a/Makefile b/Makefile deleted file mode 100644 index dd5f360..0000000 --- a/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -NAME := thu-learn-downloader - -ASSETS := assets -BUILD := build -DIST := dist - -SYSTEM != python -c 'import platform; print(platform.system().lower())' -MACHINE != python -c 'import platform; print(platform.machine().lower())' -EXE := $(if $(filter windows,$(SYSTEM)),.exe) - -DIST_TARGET := $(DIST)/$(NAME)-$(SYSTEM)-$(MACHINE)$(EXE) - -all: - -clean: - @ $(RM) --recursive --verbose $(ASSETS) - @ $(RM) --recursive --verbose $(BUILD) - @ $(RM) --recursive --verbose $(DIST) - @ $(RM) --verbose out.gif - @ find . -type d -name '__pycache__' -exec $(RM) --recursive --verbose '{}' + - @ find . -type f -name '*.spec' -delete - -demo: $(ASSETS)/demo.png - -demo-deploy: $(ASSETS)/demo.png scripts/deploy-gh-pages.sh - bash scripts/deploy-gh-pages.sh $(ASSETS) assets - -dist: $(DIST_TARGET) - -docs: main.py - typer $< utils docs - -run: openssl.cnf - OPENSSL_CONF=$< poetry run $(NAME) - -setup: - micromamba --yes --name=$(NAME) create libpython-static python=3.11 - micromamba --yes --name=$(NAME) run poetry install - -############### -# Auxiliaries # -############### - -$(ASSETS)/demo.png: demo.tape - @ mkdir --parents --verbose $(@D) - vhs $< - -$(DIST_TARGET): main.py - @ mkdir --parents --verbose $(@D) -ifneq ($(SYSTEM), windows) - python -m nuitka --standalone --onefile --output-filename=$(@F) --output-dir=$(@D) --remove-output $< -else - pyinstaller --distpath=$(DIST) --workpath=$(BUILD) --onefile --name=$(NAME)-$(SYSTEM)-$(MACHINE) $< -endif diff --git a/cspell.config.yaml b/cspell.config.yaml deleted file mode 100644 index 81d615e..0000000 --- a/cspell.config.yaml +++ /dev/null @@ -1,60 +0,0 @@ -words: - - choco - - coassb - - cython - - dmypy - - gomod - - ipynb - - jzsj - - kczy - - kjflb - - kjflid - - kjxxb - - kssj - - liblaf - - mdurl - - mkdocs - - nointeraction - - nuitka - - pybuilder - - pycache - - pydantic - - pyflow - - pyinstaller - - pynr - - pypa - - pypackages - - pysj - - pytype - - queryxnxq - - scsj - - sfgk - - thauth - - tqdm - - typer - - wjdx - - wjid - - wjlx - - wlkc - - wlkcid - - wlxt - - xktjb - - xszyid - - yjwg - - ywkcm - - zyid - - zywkcm -ignorePaths: - - "*-lock.*" - - "*.lock" -dictionaries: - - bash - - cpp - - cpp-refined - - dotnet - - golang - - makefile - - npm - - python - - python-common -allowCompoundWords: true diff --git a/cspell.json b/cspell.json new file mode 100644 index 0000000..bf4bc50 --- /dev/null +++ b/cspell.json @@ -0,0 +1,63 @@ +{ + "words": [ + "choco", + "coassb", + "cython", + "dmypy", + "gomod", + "ipynb", + "jzsj", + "kczy", + "kjflb", + "kjflid", + "kjxxb", + "kssj", + "liblaf", + "mdurl", + "mkdocs", + "nointeraction", + "nuitka", + "pybuilder", + "pycache", + "pydantic", + "pyflow", + "pyinstaller", + "pynr", + "pypa", + "pypackages", + "pysj", + "pytype", + "queryxnxq", + "scsj", + "sfgk", + "thauth", + "tqdm", + "typer", + "wjdx", + "wjid", + "wjlx", + "wlkc", + "wlkcid", + "wlxt", + "xktjb", + "xszyid", + "yjwg", + "ywkcm", + "zyid", + "zywkcm" + ], + "ignorePaths": ["*-lock.*", "*.lock", "cspell.json"], + "dictionaries": [ + "bash", + "cpp", + "cpp-legacy", + "cpp-refined", + "dotnet", + "golang", + "makefile", + "npm", + "python", + "python-common" + ], + "allowCompoundWords": true +} diff --git a/poetry.lock b/poetry.lock index 174191b..f678378 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. [[package]] name = "altgraph" @@ -652,15 +652,19 @@ [[package]] name = "pyinstaller-hooks-contrib" -version = "2023.10" +version = "2023.12" description = "Community maintained hooks for PyInstaller" optional = false python-versions = ">=3.7" files = [ - {file = "pyinstaller-hooks-contrib-2023.10.tar.gz", hash = "sha256:4b4a998036abb713774cb26534ca06b7e6e09e4c628196017a10deb11a48747f"}, - {file = "pyinstaller_hooks_contrib-2023.10-py2.py3-none-any.whl", hash = "sha256:6dc1786a8f452941245d5bb85893e2a33632ebdcbc4c23eea41f2ee08281b0c0"}, + {file = "pyinstaller-hooks-contrib-2023.12.tar.gz", hash = "sha256:11a9d59d903723dd693e8c10b054f3ea1ecad390623c9fa527c731d715fc5b3f"}, + {file = "pyinstaller_hooks_contrib-2023.12-py2.py3-none-any.whl", hash = "sha256:6a601a0d783fa725327fc6ac712779475dc8979f639419c7fcd460dd8d0a6d2a"}, ] +[package.dependencies] +packaging = ">=22.0" +setuptools = ">=42.0.0" + [package.source] type = "legacy" url = "https://pypi.tuna.tsinghua.edu.cn/simple" @@ -783,13 +787,13 @@ [[package]] name = "setuptools" -version = "69.0.2" +version = "69.0.3" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "setuptools-69.0.2-py3-none-any.whl", hash = "sha256:1e8fdff6797d3865f37397be788a4e3cba233608e9b509382a2777d25ebde7f2"}, - {file = "setuptools-69.0.2.tar.gz", hash = "sha256:735896e78a4742605974de002ac60562d286fa8051a7e2299445e8e8fbb01aa6"}, + {file = "setuptools-69.0.3-py3-none-any.whl", hash = "sha256:385eb4edd9c9d5c17540511303e39a147ce2fc04bc55289c322b9e5904fe2c05"}, + {file = "setuptools-69.0.3.tar.gz", hash = "sha256:be1af57fc409f93647f2e8e4573a142ed38724b8cdd389706a867bb4efcf1e78"}, ] [package.extras] diff --git a/thu_learn_downloader/download/filename.py b/thu_learn_downloader/download/filename.py index f1df60f..02da616 100644 --- a/thu_learn_downloader/download/filename.py +++ b/thu_learn_downloader/download/filename.py @@ -49,7 +49,7 @@ ) -> Path: filename: Path = Path(attachment.name) filename = filename.with_stem( - f"{homework.number:02d}-{attachment.type_}-{homework.title}" + f"{homework.number:02d}-{homework.title}-{attachment.type_}" ) return ( prefix