-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_arch.py
More file actions
executable file
·27 lines (23 loc) · 803 Bytes
/
Copy pathtest_arch.py
File metadata and controls
executable file
·27 lines (23 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
import importlib
for mod in list(sys.modules.keys()):
if 'obtainhub' in mod:
del sys.modules[mod]
sys.path.insert(0, '/root/project/github/public-repository/ObtainHub')
from obtainhub.core.asset_matcher import AssetMatcher, Architecture
matcher = AssetMatcher()
print('Architecture.X64:', Architecture.X64)
print('arch_regexes keys:', list(matcher.arch_regexes.keys()))
print()
# Test the loop
name = 'app-x64.msi'
print('Testing:', name)
for arch in [Architecture.X64, Architecture.ARM64, Architecture.X86]:
print(' Checking:', arch)
for regex in matcher.arch_regexes[arch]:
result = regex.search(name)
if result:
print(' MATCH:', regex.pattern, '->', result.group())
break
else:
print(' No match for', arch)