@@ -40,20 +40,25 @@ def build_with_pdm_packer():
4040 print ("Building with pdm-packer..." )
4141 ensure_dist_dir ()
4242 os .environ ["PYTHONOPTIMIZE" ] = "2"
43- result = subprocess .run ([
44- shutil .which ("pdm" ),
45- "pack" ,
46- "-m" , "vcf_generator_lite.__main__:main" ,
47- "-o" , os .path .join ("dist" , OUTPUT_BASE_NAME_TEMPLATE .format (
48- version = APP_VERSION ,
49- platform = PLATFORM_PYTHON ,
50- distribution = "zipapp"
51- ) + ".pyzw" ),
52- "--interpreter" , f"/usr/bin/env python{ PYTHON_VERSION } " ,
53- "--compile" ,
54- "--compress" ,
55- "--no-py" ,
56- ])
43+ result = subprocess .run (
44+ [
45+ shutil .which ("pdm" ),
46+ "pack" ,
47+ "-m" ,
48+ "vcf_generator_lite.__main__:main" ,
49+ "-o" ,
50+ os .path .join (
51+ "dist" ,
52+ OUTPUT_BASE_NAME_TEMPLATE .format (version = APP_VERSION , platform = PLATFORM_PYTHON , distribution = "zipapp" )
53+ + ".pyzw" ,
54+ ),
55+ "--interpreter" ,
56+ f"/usr/bin/env python{ PYTHON_VERSION } " ,
57+ "--compile" ,
58+ "--compress" ,
59+ "--no-py" ,
60+ ]
61+ )
5762 print ("Building finished." )
5863 return result .returncode
5964
@@ -66,29 +71,32 @@ def pack_with_innosetup() -> int:
6671 return result
6772
6873 os .environ ["PATH" ] += os .pathsep + "C:\\ Program Files (x86)\\ Inno Setup 6\\ "
69- result = subprocess .run ([
70- shutil .which ("iscc" ),
71- "/D" + f"OutputBaseFilename={ OUTPUT_BASE_NAME_TEMPLATE .format (
74+ result = subprocess .run (
75+ [
76+ shutil .which ("iscc" ),
77+ "/D"
78+ + f"OutputBaseFilename={ OUTPUT_BASE_NAME_TEMPLATE .format (
7279 version = APP_VERSION ,
7380 platform = PLATFORM_NATIVE ,
7481 distribution = "setup"
7582 )} " ,
76- "/D" + f"MyAppCopyright={ APP_COPYRIGHT } " ,
77- "/D" + f"MyAppVersion={ APP_VERSION } " ,
78- os .path .abspath ('setup.iss' ),
79- ])
83+ "/D" + f"MyAppCopyright={ APP_COPYRIGHT } " ,
84+ "/D" + f"MyAppVersion={ APP_VERSION } " ,
85+ os .path .abspath ("setup.iss" ),
86+ ]
87+ )
8088 print ("Packaging finished." )
8189 return result .returncode
8290
8391
8492def pack_with_zipfile ():
8593 print ("Packaging with ZipFile..." )
8694 require_pyinstaller_output ()
87- zip_path = os .path .join ("dist" , OUTPUT_BASE_NAME_TEMPLATE . format (
88- version = APP_VERSION ,
89- platform = PLATFORM_NATIVE ,
90- distribution = "portable"
91- ) + ".zip" )
95+ zip_path = os .path .join (
96+ "dist" ,
97+ OUTPUT_BASE_NAME_TEMPLATE . format ( version = APP_VERSION , platform = PLATFORM_NATIVE , distribution = "portable" )
98+ + ".zip" ,
99+ )
92100 with ZipFile (zip_path , "w" ) as zip_file :
93101 for path , dirs , files in os .walk (os .path .join ("dist" , "vcf_generator_lite" )):
94102 for file_path in [os .path .join (path , file ) for file in files ]:
@@ -99,11 +107,12 @@ def pack_with_zipfile():
99107def main () -> int :
100108 parser = argparse .ArgumentParser ()
101109 parser .add_argument (
102- "-t" , "--type" ,
110+ "-t" ,
111+ "--type" ,
103112 type = str ,
104113 default = "installer" ,
105114 choices = ["installer" , "portable" , "zipapp" ],
106- help = "应用打包类型(默认:%(default)s)"
115+ help = "应用打包类型(默认:%(default)s)" ,
107116 )
108117 args = parser .parse_args ()
109118
0 commit comments