Skip to content

Commit b5ace31

Browse files
committed
fix: 修复打包
1 parent a86b113 commit b5ace31

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

ice_find_symbol.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
result = set()
2323
file_count = 0
2424

25+
def get_resource_path(relative_path):
26+
if getattr(sys, 'frozen', False):
27+
base_path = sys._MEIPASS
28+
else:
29+
base_path = os.path.abspath(".")
30+
return os.path.join(base_path, relative_path)
31+
2532
import platform, shutil
2633

2734
def find_symbol(lib_dir, symbol):
@@ -37,12 +44,15 @@ def find_symbol(lib_dir, symbol):
3744
cmd = ''
3845
if platform.system() == "Windows":
3946
# 如果是Windows平台,使用内置的nm.exe
40-
cmd = f'.\\tools\\nm.exe -C "{os.path.join(root, file)}" | findstr -i "{symbol}"'
47+
nm_path = get_resource_path('tools\\nm.exe')
48+
cmd = f'{nm_path} -C "{os.path.join(root, file)}" | findstr -i "{symbol}"'
4149
else:
4250
# 如果是非Windows平台,是用系统的nm命令
4351
cmd = f"nm -C {os.path.join(root, file)} | grep {symbol}"
4452

4553
ret = util.subprocess_run(cmd, red_color_list=['U '], green_color_list=[' T ', ' t '])
54+
if 'recognised but unhandled machine type' in ret:
55+
continue
4656

4757
for line in ret.splitlines():
4858
# 利用set,进行去重处理

spec/ice_find_symbol.win32.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
a = Analysis(
55
['../ice_find_symbol.py'],
66
pathex=[],
7-
binaries=[],
8-
datas=[('../tools', './tools')],
7+
binaries=[('../tools/nm.exe', 'tools/')],
8+
datas=[],
99
hiddenimports=[],
1010
hookspath=[],
1111
hooksconfig={},

0 commit comments

Comments
 (0)