使用PyInstaller打包;db.json移动到categories中;Popen不打开新窗口

This commit is contained in:
zhbaor 2021-11-04 01:15:50 +08:00
parent b3a3738f6d
commit 8d77a2590d
4 changed files with 71 additions and 5 deletions

5
.gitignore vendored
View file

@ -1,2 +1,7 @@
.vscode .vscode
config.ini config.ini
build
dist
__pycache__
*.pyc
manage.spec

View file

@ -4,6 +4,7 @@ verify_ssl = true
name = "pypi" name = "pypi"
[packages] [packages]
pyinstaller = "*"
[dev-packages] [dev-packages]
black = "*" black = "*"

64
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "841a2d369692928656cccaf937b8e83c04af6dfa2f7addb75236739b24bff7fa" "sha256": "cd799ae0b651f5048d9f30cc624dba709b768d5c619b6da5b63bfcca682c9f15"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "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": { "develop": {
"black": { "black": {
"hashes": [ "hashes": [
@ -33,6 +85,14 @@
"markers": "python_version >= '3.6'", "markers": "python_version >= '3.6'",
"version": "==8.0.3" "version": "==8.0.3"
}, },
"colorama": {
"hashes": [
"sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b",
"sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"
],
"markers": "platform_system == 'Windows'",
"version": "==0.4.4"
},
"mypy-extensions": { "mypy-extensions": {
"hashes": [ "hashes": [
"sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d",

View file

@ -1,7 +1,7 @@
from configparser import ConfigParser from configparser import ConfigParser
from pathlib import Path from pathlib import Path
from json import dump, dumps 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 threading import Thread
from queue import Empty, SimpleQueue from queue import Empty, SimpleQueue
from tkinter import * from tkinter import *
@ -47,7 +47,7 @@ def generate_db(config: ConfigParser) -> str:
for file in category.iterdir(): for file in category.iterdir():
output_category["files"].append(file.name) output_category["files"].append(file.name)
output.append(output_category) 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) dump(output, f)
return dumps(output) 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"db.json: {db_log}\n")
output_queue.put_nowait(f"command: {command}\n") output_queue.put_nowait(f"command: {command}\n")
output_queue.put_nowait("Started lftp...\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 ret_val = None
while ret_val is None: while ret_val is None:
ret_val = proc.poll() ret_val = proc.poll()