kinve 1 жил өмнө
parent
commit
845ae936f4

+ 11 - 0
GitAutoupdater.py

@@ -5,6 +5,10 @@ import requests
 from urllib.request import urlretrieve
 import os
 import argparse
+import json
+
+g_config = None
+config_path = 'config.json'
 
 def reporthook(count, block_size, total_size):
     """
@@ -48,6 +52,13 @@ if __name__ == "__main__":
     if args.p:
         proxy = str(args.p)
 
+    g_config = {}
+    if os.path.exists(config_path):
+        with open(config_path) as file:
+            g_config = json.load(file)
+        if 'proxy' in g_config and not args.p: # args.p优先
+            proxy = g_config['proxy']        
+
     http_down(project, down_list, proxy)
 
 

+ 3 - 0
config.example.json

@@ -0,0 +1,3 @@
+{
+	"proxy": "https://gh-proxy.com/https://github.com/"
+}

BIN
dist/GitAutoupdater.exe


+ 1 - 2
打包 - nuitka.bat

@@ -1,2 +1 @@
-set upx=%~dp0\upx.exe
-nuitka --standalone --mingw64 --show-memory --show-progress --nofollow-imports --plugin-enable=upx --upx-binary=%upx%  --output-dir=out  GitAutoupdater.py
+D:\Programs\Python\Python310/python.exe -m nuitka --onefile --show-progress --lto=no --assume-yes-for-downloads --output-dir=E:/project/PyCode/GitAutoupdater/output --main=E:/project/PyCode/GitAutoupdater/GitAutoupdater.py --windows-icon-from-ico=E:/project/PyCode/GitAutoupdater/logo.ico