diff --git a/Makefile b/Makefile index 1e69417..90398d2 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,9 @@ EXE := endif -TARGET := $(DIST)/$(NAME)$(EXE) +TARGET := $(DIST)/$(NAME)$(EXE) +TARGET_INSTALL := $(BIN)/$(NAME)$(EXE) +TARGET_RENAME := $(DIST)/$(NAME)-$(OS)-$(ARCH)$(EXE) build: $(TARGET) @@ -21,23 +23,22 @@ demo: $(CURDIR)/demo.gif -install: $(TARGET) | $(BIN) - install --target-directory=$(BIN) $< +deps: $(CURDIR)/poetry.lock $(CURDIR)/requirements.txt + +install: $(TARGET_INSTALL) pretty: isort --profile black $(CURDIR) black $(CURDIR) -rename: $(TARGET) -ifneq ($(and $(OS), $(ARCH)), ) - mv $< $(DIST)/$(NAME)-$(OS)-$(ARCH)$(EXE) -endif +rename: $(TARGET_RENAME) -$(TARGET): - pyinstaller --distpath $(DIST) --onefile --name $(NAME) $(CURDIR)/main.py +ALWAYS: -$(BIN): - mkdir --parents $@ +$(TARGET_INSTALL): $(TARGET) +$(TARGET_RENAME) : $(TARGET) +$(TARGET_INSTALL) $(TARGET_RENAME): + install -D --mode=u=rwx,go=rx --no-target-directory $< $@ $(CURDIR)/demo.gif: $(CURDIR)/demo.tape ifeq ($(BW_SESSION),) @@ -45,3 +46,12 @@ else vhs < $< endif + +$(CURDIR)/poetry.lock: ALWAYS + poetry lock + +$(CURDIR)/requirements.txt: $(CURDIR)/poetry.lock + poetry export --output=$@ --without-hashes --without-urls + +$(TARGET): + pyinstaller --distpath $(DIST) --onefile --name $(NAME) $(CURDIR)/main.py diff --git a/poetry.lock b/poetry.lock index 71a36a9..0056174 100644 --- a/poetry.lock +++ b/poetry.lock @@ -444,14 +444,14 @@ [[package]] name = "setuptools" -version = "67.6.1" +version = "67.7.1" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.7.1-py3-none-any.whl", hash = "sha256:6f0839fbdb7e3cfef1fc38d7954f5c1c26bf4eebb155a55c9bf8faf997b9fb67"}, + {file = "setuptools-67.7.1.tar.gz", hash = "sha256:bb16732e8eb928922eabaa022f881ae2b7cdcfaf9993ef1f5e841a96d32b8e0c"}, ] [package.extras] diff --git a/thu_learn_downloader/helper.py b/thu_learn_downloader/helper.py index 830a69b..c7cb577 100644 --- a/thu_learn_downloader/helper.py +++ b/thu_learn_downloader/helper.py @@ -90,15 +90,18 @@ else: results = json["object"] - return list( - map( - parser.parse_file, - results, - [file_clazz] * len(results), - [course_id] * len(results), - [course_type] * len(results), + files: list[t.File] = [ + parser.parse_file( + raw=result, + file_clazz=file_clazz, + course_id=course_id, + course_type=course_type, ) - ) + for result in results + ] + files.sort(key=lambda x: x.upload_time) + + return files def get_homework_list( self, course_id: str, course_type: t.CourseType = t.CourseType.STUDENT