@@ -21,6 +21,7 @@ def main():
2121 parser = argparse .ArgumentParser (description = "StreamDeckSDK" )
2222 parser .add_argument ("command" )
2323 parser .add_argument ("-i" , default = None , required = False , type = str , help = "Input file" , )
24+ parser .add_argument ('-F' , action = 'store_true' , help = "Force build" , )
2425 args = parser .parse_args ()
2526 logger .info (args )
2627 command = args .command
@@ -29,7 +30,7 @@ def main():
2930 elif command == "build" :
3031 if args .i is None :
3132 raise ValueError ("Invalid value for -i param." )
32- input_file = Path (args .i ).resolve ()
33+ input_file = str ( Path (args .i ).resolve () )
3334
3435 now = datetime .now ()
3536 dt = now .strftime ("%Y_%m_%d_%H_%M_%S" )
@@ -40,6 +41,11 @@ def main():
4041 [p .unlink () for p in BASE_DIR .rglob ('*.py[co]' )]
4142 [p .rmdir () for p in BASE_DIR .rglob ('__pycache__' )]
4243
44+ force = args .F
45+ if force :
46+ force_build (i = input_file , o = release_dir )
47+ return
48+
4349 os_name = platform .system ()
4450 logger .info (os_name )
4551 if os_name == "Darwin" :
@@ -52,3 +58,21 @@ def main():
5258 subprocess .run (
5359 [distribution_tool , "-b" , "-i" , input_file , "-o" , release_dir ],
5460 )
61+
62+
63+ def force_build (i : str , o : str ) -> None :
64+ i = Path (i )
65+ o = Path (o )
66+ output_zip_base_name = o / i .name
67+ shutil .make_archive (
68+ base_name = str (output_zip_base_name .resolve ()),
69+ format = "zip" ,
70+ root_dir = str (i .parent .resolve ()),
71+ base_dir = i .name ,
72+ )
73+ output_zip_file_path = o / f"{ i .name } .zip"
74+ output_plugin_file_path = o / i .name .replace (".sdPlugin" , ".streamDeckPlugin" )
75+ os .rename (
76+ str (output_zip_file_path .resolve ()),
77+ str (output_plugin_file_path .resolve ())
78+ )
0 commit comments