1414from typing import List
1515
1616import packaging .version
17+ import pefile
18+ from auditwheel .elfutils import elf_find_versioned_symbols
19+ from auditwheel .lddtree import lddtree
20+ from elftools .elf .elffile import ELFFile
1721
1822
1923def check_dll_architecture (path : str , x86 = False ):
2024 arch = '32bit' if x86 else '64bit'
2125 print (f'Checking if file { path } is { arch } ...' )
22- try :
23- import pefile
24- except ImportError :
25- print ('Install pefile: pip install pefile' )
26- sys .exit (1 )
2726
2827 if not os .path .exists (path ):
2928 print (f'File { path } is missing!' )
@@ -44,11 +43,6 @@ def check_dll_is_static(path: str, allowed_imports: List = None):
4443 """
4544
4645 print (f'Checking if file { path } is static...' )
47- try :
48- import pefile
49- except ImportError :
50- print ('Install pefile: pip install pefile' )
51- sys .exit (1 )
5246
5347 if not os .path .exists (path ):
5448 print (f'File { path } is missing!' )
@@ -72,12 +66,6 @@ def check_dll_is_static(path: str, allowed_imports: List = None):
7266def check_so_architecture (path : str , x86 = False ):
7367 arch = '32bit' if x86 else '64bit'
7468 print (f'Checking if file { path } is { arch } ...' )
75- try :
76- import elftools
77- except ImportError :
78- print ('Install elftools: pip install pyelftools' )
79- sys .exit (1 )
80- from elftools .elf .elffile import ELFFile
8169
8270 if not os .path .exists (path ):
8371 print (f'File { path } is missing!' )
@@ -130,15 +118,6 @@ def check_so_is_manylinux2014(path: str, allowed_imports: List = None):
130118 allowed_imports_lower .add (allowed_import )
131119
132120 print (f'Checking if file { path } is manylinux2014...' )
133- try :
134- import auditwheel
135- except ImportError :
136- print ('Install auditwheel: pip install auditwheel' )
137- sys .exit (1 )
138-
139- from auditwheel .lddtree import lddtree
140- from auditwheel .elfutils import elf_find_versioned_symbols
141- from elftools .elf .elffile import ELFFile
142121
143122 if not os .path .exists (path ):
144123 print (f'File { path } is missing!' )
0 commit comments