From 8d77a2590df0429f677e179a23d34d6888b61356 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong <1040110848@qq.com> Date: Thu, 4 Nov 2021 01:15:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8PyInstaller=E6=89=93=E5=8C=85?= =?UTF-8?q?=EF=BC=9Bdb.json=E7=A7=BB=E5=8A=A8=E5=88=B0categories=E4=B8=AD?= =?UTF-8?q?=EF=BC=9BPopen=E4=B8=8D=E6=89=93=E5=BC=80=E6=96=B0=E7=AA=97?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 ++++ Pipfile | 1 + Pipfile.lock | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++-- manage.py | 6 ++--- 4 files changed, 71 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index bf7f378..0ff4f64 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ .vscode config.ini +build +dist +__pycache__ +*.pyc +manage.spec diff --git a/Pipfile b/Pipfile index 96763be..20b62c8 100644 --- a/Pipfile +++ b/Pipfile @@ -4,6 +4,7 @@ verify_ssl = true name = "pypi" [packages] +pyinstaller = "*" [dev-packages] black = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 655704e..d3cc13d 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "841a2d369692928656cccaf937b8e83c04af6dfa2f7addb75236739b24bff7fa" + "sha256": "cd799ae0b651f5048d9f30cc624dba709b768d5c619b6da5b63bfcca682c9f15" }, "pipfile-spec": 6, "requires": { @@ -15,7 +15,59 @@ } ] }, - "default": {}, + "default": { + "altgraph": { + "hashes": [ + "sha256:743628f2ac6a7c26f5d9223c91ed8ecbba535f506f4b6f558885a8a56a105857", + "sha256:ebf2269361b47d97b3b88e696439f6e4cbc607c17c51feb1754f90fb79839158" + ], + "version": "==0.17.2" + }, + "future": { + "hashes": [ + "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d" + ], + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==0.18.2" + }, + "pefile": { + "hashes": [ + "sha256:344a49e40a94e10849f0fe34dddc80f773a12b40675bf2f7be4b8be578bdd94a" + ], + "markers": "sys_platform == 'win32'", + "version": "==2021.9.3" + }, + "pyinstaller": { + "hashes": [ + "sha256:0fe1fdd6851663d378e85692709506d5d7c6dfc59105315ab78ba99dac689ca3", + "sha256:351bd218799f6253dd195c7c138b29eab96b4b1b805df2ed03f49c30343764c5", + "sha256:3ba0dc50f8951f3c9ab4536b452f8c126ff18ff8439aa77b7e0a1b81a18c7ccf", + "sha256:3bb837a925162518ec58f0b704c36b9c79b92f30df2fe083ddf63175de1eedcb", + "sha256:3ff8be1da3ee971c33d3ce072dcb499658206761e0d36c38d6b83acc838d2a78", + "sha256:72e3995ae182de2e37625a1debe1d0877a85039fe1fcda062891cfa07606072a", + "sha256:b67c9d2844b1a47c0a83dee879ba9fe8ca4f0f076483ab279cdec4a05be8510e", + "sha256:be2ae2aa554604eb467d02b7ac91f2f59d72a3f45ddfa2718c2e3ae9c850793c", + "sha256:c4b3976e6891f1b46ec8baecc8a9888fc71a92178a1ee67c7c5bcb35acf6990d" + ], + "index": "pypi", + "version": "==4.6" + }, + "pyinstaller-hooks-contrib": { + "hashes": [ + "sha256:169b09802a19f83593114821d6ba0416a05c7071ef0ca394f7bfb7e2c0c916c8", + "sha256:a52bc3834281266bbf77239cfc9521923336ca622f44f90924546ed6c6d3ad5e" + ], + "version": "==2021.3" + }, + "pywin32-ctypes": { + "hashes": [ + "sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942", + "sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98" + ], + "markers": "sys_platform == 'win32'", + "version": "==0.2.0" + } + }, "develop": { "black": { "hashes": [ @@ -33,6 +85,14 @@ "markers": "python_version >= '3.6'", "version": "==8.0.3" }, + "colorama": { + "hashes": [ + "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", + "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2" + ], + "markers": "platform_system == 'Windows'", + "version": "==0.4.4" + }, "mypy-extensions": { "hashes": [ "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", diff --git a/manage.py b/manage.py index 31b76e3..b6d9474 100644 --- a/manage.py +++ b/manage.py @@ -1,7 +1,7 @@ from configparser import ConfigParser from pathlib import Path from json import dump, dumps -from subprocess import STDOUT, Popen, PIPE +from subprocess import CREATE_NO_WINDOW, STDOUT, Popen, PIPE from threading import Thread from queue import Empty, SimpleQueue from tkinter import * @@ -47,7 +47,7 @@ def generate_db(config: ConfigParser) -> str: for file in category.iterdir(): output_category["files"].append(file.name) output.append(output_category) - with open(Path(local_dir, "db.json"), "w") as f: + with open(Path(local_dir, "categories", "db.json"), "w") as f: dump(output, f) return dumps(output) @@ -87,7 +87,7 @@ def sync_func(command: list[str]) -> None: output_queue.put_nowait(f"db.json: {db_log}\n") output_queue.put_nowait(f"command: {command}\n") output_queue.put_nowait("Started lftp...\n") - proc = Popen(command, stdout=PIPE, stderr=STDOUT) + proc = Popen(command, stdout=PIPE, stderr=STDOUT, creationflags=CREATE_NO_WINDOW) ret_val = None while ret_val is None: ret_val = proc.poll()