11
11
# https://docs.python.org/3/library/platform.html#platform.architecture
12
12
bits = 8 * (8 if sys .maxsize > 2 ** 32 else 4 )
13
13
14
- _PLATFORM_REPLACEMENT_MAP = {
15
- 'manylinux1_x86_64' : ['linux_x86_64' ],
16
- 'manylinux2010_x86_64' : ['linux_x86_64' ],
17
- 'manylinux2014_x86_64' : ['linux_x86_64' ],
18
- 'manylinux1_i686' : ['linux_i686' ],
19
- 'manylinux2010_i686' : ['linux_i686' ],
20
- 'manylinux2014_i686' : ['linux_i686' ],
21
- }
14
+
15
+ _PLATFORM_REPLACEMENT_MAP = {}
16
+ for _policy in {'manylinux1' , 'manylinux2010' }:
17
+ for _arch in {'x86_64' , 'i686' }:
18
+ _key = '{}_{}' .format (_policy , _arch )
19
+ _value = 'linux_{}' .format (_arch )
20
+ _PLATFORM_REPLACEMENT_MAP [_key ] = [_value ]
21
+
22
+ for _policy in {'manylinux2014' }:
23
+ for _arch in {
24
+ 'x86_64' , 'i686' , 'aarch64' , 'armv7l' , 'ppc64' , 'ppc64le' , 's390x'
25
+ }:
26
+ _key = '{}_{}' .format (_policy , _arch )
27
+ _value = 'linux_{}' .format (_arch )
28
+ _PLATFORM_REPLACEMENT_MAP [_key ] = [_value ]
22
29
23
30
24
31
def get_arch_name ():
@@ -33,9 +40,13 @@ def get_arch_name():
33
40
34
41
35
42
with open (join (dirname (abspath (__file__ )), 'policy.json' )) as f :
36
- _POLICIES = json .load (f )
37
- for p in _POLICIES :
38
- p ['name' ] = p ['name' ] + '_' + _ARCH_NAME
43
+ _POLICIES = []
44
+ _policies_temp = json .load (f )
45
+ for _p in _policies_temp :
46
+ _name = _p ['name' ] + '_' + _ARCH_NAME
47
+ if _name in _PLATFORM_REPLACEMENT_MAP or _name .startswith ('linux' ):
48
+ _p ['name' ] = _name
49
+ _POLICIES .append (_p )
39
50
40
51
POLICY_PRIORITY_HIGHEST = max (p ['priority' ] for p in _POLICIES )
41
52
POLICY_PRIORITY_LOWEST = min (p ['priority' ] for p in _POLICIES )
0 commit comments