File: add_longdouble_format_property.py

package info (click to toggle)
numpy 1%3A2.3.5%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 86,232 kB
  • sloc: python: 255,841; asm: 232,483; ansic: 212,578; cpp: 157,469; f90: 1,575; sh: 845; fortran: 567; makefile: 431; sed: 139; xml: 109; java: 97; perl: 82; cs: 62; javascript: 53; objc: 33; lex: 13; yacc: 9
file content (40 lines) | stat: -rw-r--r-- 1,083 bytes parent folder | download
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
#!/usr/bin/python3
# Architecture-specific long double formats for
# cross compilation
#
# This script expects two positional argument
# 1. the meson cross file
# 2. the DEB_HOST_ARCH architecture name
#
import configparser
import sys


class CaseSensitiveConfigParser(configparser.ConfigParser):
    optionxform = staticmethod(str)


cross_file = CaseSensitiveConfigParser()
with open(sys.argv[1]) as f:
    cross_file.read_file(f)

cross_file["properties"]["longdouble_format"] = repr(
    {
        "amd64": "INTEL_EXTENDED_16_BYTES_LE",
        "arm64": "IEEE_QUAD_LE",
        "armel": "IEEE_DOUBLE_LE",
        "armhf": "IEEE_DOUBLE_LE",
        "hppa": "IEEE_DOUBLE_BE",
        "i386": "INTEL_EXTENDED_12_BYTES_LE",
        "m68k": "MOTOROLA_EXTENDED_12_BYTES_BE",
        "mips64el": "IEEE_QUAD_LE",
        "ppc64": "IBM_DOUBLE_DOUBLE_BE",
        "ppc64el": "IEEE_QUAD_LE",
        "riscv64": "IEEE_QUAD_LE",
        "s390x": "IEEE_QUAD_BE",
        "sparc64": "IEEE_QUAD_BE",
    }.get(sys.argv[2], "UNKNOWN")
)

with open(sys.argv[1], "w") as f:
    cross_file.write(f)