Skip to content

Commit 189ec3a

Browse files
committed
Add inspect to Nuitka packages and improve file handling
Added 'inspect' to the Nuitka plugin's package list during initialization. Applied functools.cache to hash_file for efficiency. Now removes source files after successful compilation. In makexe.py, adjusted compression logic to skip compression when an icon is provided.
1 parent ddddbec commit 189ec3a

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Plugins/cython.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import shutil
44
import logging
55
import hashlib
6+
import functools
67

78
# Shutup vars
89
folder_path = ''
@@ -99,7 +100,7 @@ def compile_file(file_path, keep=False):
99100
except Exception as e:
100101
logging.error(f"Failed to compile {file_path} with Cython: {e}")
101102
return False
102-
103+
@functools.cache
103104
def hash_file(file_path):
104105
if os.path.exists(file_path):
105106
sha256 = hashlib.sha256()

Plugins/nuitka.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
import subprocess
44
import logging
55
import hashlib
6+
import functools
67

78
# Shutup vars
89
folder_path = ''
910
plugin = ''
11+
args = ''
12+
13+
14+
def init():
15+
args.package.append('inspect')
1016

1117
def compile_file(file_path):
1218
try:
@@ -28,7 +34,8 @@ def compile_file(file_path):
2834
except Exception as e:
2935
logging.error(f"Failed to compile {file_path} with Cython: {e}")
3036
return False
31-
37+
38+
@functools.cache
3239
def hash_file(file_path):
3340
if os.path.exists(file_path):
3441
sha256 = hashlib.sha256()
@@ -73,6 +80,7 @@ def midway():
7380
if not plugin.compile_file(file_full_path):
7481
logging.error(f"Failed to compile {rel_path_in_lib}. Exiting.")
7582
sys.exit(1)
83+
os.remove(file_full_path)
7684
logging.info(f"Successfully compiled {rel_path_in_lib} with Nuitka.")
7785

7886

components/makexe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,11 @@ def main(folder_path, args):
202202
else:
203203
error(f'Icon file not found: {args.icon}')
204204

205-
if not args.disable_compressing:
205+
if not args.disable_compressing and not args.icon:
206206
info('Compressing executable (No progress available)')
207207
if args.folder: compress_file_with_upx(f"{folder_name}\\{folder_name}.exe")
208208
else: compress_file_with_upx(f"{folder_name}.exe")
209+
209210

210211
if args.zip: compress_folder_with_progress(folder_path, folder_name)
211212

0 commit comments

Comments
 (0)