blob: 0061b9e598e859844cb83c500f0835aee618d773 (
plain) (
blame)
| 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 | import subprocess
from collections import defaultdict
from .syms import syms
def gen_builtin():
    res = defaultdict(dict)
    for k, v in syms.items():
        mod, sym = k.split('|')
        res[mod][sym] = v
    return res
builtin_symbols = gen_builtin()
caps = builtin_symbols['_capability']
def find_library(name, find_next):
    subst = {
        'rt': 'c',
        'pthread': 'c',
        'm': 'c',
    }
    builtin = builtin_symbols.get(subst.get(name, name))
    if builtin:
        return {
            'name': name,
            'symbols': builtin,
        }
    if 'musl' in caps:
        return None
    try:
        subprocess.Popen.__patched__
        return None
    except Exception:
        pass
    return find_next(name)
 |