3030NAME = "ClinicalDBSAnnotator"
3131ENTRYPOINT = PROJECT_ROOT / "run.py"
3232
33+
3334def _read_version () -> str :
3435 init_path = SRC_DIR / "clinical_dbs_annotator" / "__init__.py"
3536 text = init_path .read_text (encoding = "utf-8" )
36- m = re .search (r'^__version__\s*=\s*["\']([^"\']+)["\']\s*$' , text , flags = re .MULTILINE )
37+ m = re .search (
38+ r'^__version__\s*=\s*["\']([^"\']+)["\']\s*$' , text , flags = re .MULTILINE
39+ )
3740 if not m :
3841 raise RuntimeError (f"Could not determine version from { init_path } " )
3942 return m .group (1 )
@@ -80,6 +83,7 @@ def _base_version(version: str) -> str:
8083 "imageformats" ,
8184]
8285
86+
8387def build_nuitka (console : bool = False , onefile : bool = False ) -> None :
8488 """Build the executable with Nuitka."""
8589 DIST_DIR .mkdir (exist_ok = True )
@@ -118,20 +122,24 @@ def build_nuitka(console: bool = False, onefile: bool = False) -> None:
118122
119123 cmd .append ("--follow-imports" )
120124
121- cmd .extend ([
122- "--enable-plugin=pyside6" ,
123- ])
125+ cmd .extend (
126+ [
127+ "--enable-plugin=pyside6" ,
128+ ]
129+ )
124130
125131 icon_path = ICONS_DIR / "logoneutral.ico"
126132 if icon_path .exists ():
127133 cmd .append (f"--windows-icon-from-ico={ icon_path } " )
128134
129- cmd .extend ([
130- "--windows-company-name=Brain Modulation Lab" ,
131- "--windows-product-name=Clinical DBS Annotator" ,
132- f"--windows-file-version={ BASE_VERSION } " ,
133- f"--windows-product-version={ BASE_VERSION } " ,
134- ])
135+ cmd .extend (
136+ [
137+ "--windows-company-name=Brain Modulation Lab" ,
138+ "--windows-product-name=Clinical DBS Annotator" ,
139+ f"--windows-file-version={ BASE_VERSION } " ,
140+ f"--windows-product-version={ BASE_VERSION } " ,
141+ ]
142+ )
135143
136144 cmd .append (str (ENTRYPOINT ))
137145
@@ -141,6 +149,7 @@ def build_nuitka(console: bool = False, onefile: bool = False) -> None:
141149
142150 try :
143151 import subprocess
152+
144153 subprocess .run (cmd , check = True , cwd = PROJECT_ROOT )
145154 print ("\n ✅ Build completed successfully!" )
146155
@@ -151,7 +160,7 @@ def build_nuitka(console: bool = False, onefile: bool = False) -> None:
151160
152161 if exe_path .exists ():
153162 print (f"📦 Executable: { exe_path } " )
154- print (f"📊 Size: { exe_path .stat ().st_size / (1024 * 1024 ):.1f} MB" )
163+ print (f"📊 Size: { exe_path .stat ().st_size / (1024 * 1024 ):.1f} MB" )
155164 else :
156165 print ("⚠️ Executable not found at expected location" )
157166
@@ -162,12 +171,19 @@ def build_nuitka(console: bool = False, onefile: bool = False) -> None:
162171 print ("\n ❌ Nuitka not found. Install it with: pip install nuitka" )
163172 sys .exit (1 )
164173
174+
165175if __name__ == "__main__" :
166176 parser = argparse .ArgumentParser (description = "Build Windows executable with Nuitka" )
167- parser .add_argument ("--console" , action = "store_true" ,
168- help = "Include console window (useful for debugging)" )
169- parser .add_argument ("--onefile" , action = "store_true" ,
170- help = "Create single .exe file (default: directory bundle)" )
177+ parser .add_argument (
178+ "--console" ,
179+ action = "store_true" ,
180+ help = "Include console window (useful for debugging)" ,
181+ )
182+ parser .add_argument (
183+ "--onefile" ,
184+ action = "store_true" ,
185+ help = "Create single .exe file (default: directory bundle)" ,
186+ )
171187
172188 args = parser .parse_args ()
173189
0 commit comments