File: stubbed_arch_table.py

package info (click to toggle)
python-debian 1.0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,260 kB
  • sloc: python: 12,905; makefile: 239; sh: 25
file content (46 lines) | stat: -rw-r--r-- 1,326 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
41
42
43
44
45
46
from io import StringIO
from os import PathLike
from typing import Union

from debian._arch_table import DpkgArchTable

stubbed_cpu_table_data = """\
# Version=1.0
#
# This file contains the table of known CPU names.
#
# [...]
#
# <Debian name> <GNU name>      <config.guess regex>    <Bits>  <Endianness>
i386            i686            (i[34567]86|pentium)    32      little
amd64           x86_64          (amd64|x86_64)          64      little
arm             arm             arm.*                   32      little
arm64           aarch64         aarch64                 64      little
"""

stubbed_tuple_table_data = """\
# Version=1.0
#
# [...]
#
# Supported variables: <cpu>
#
# <Debian arch tuple>           <Debian arch name>
eabihf-gnu-linux-arm            armhf
eabi-gnu-linux-arm              armel
x32-gnu-linux-amd64             x32
base-gnu-linux-<cpu>            <cpu>
eabihf-gnu-kfreebsd-arm         kfreebsd-armhf
base-gnu-kfreebsd-<cpu>         kfreebsd-<cpu>
"""


class StubbedDpkgArchTable(DpkgArchTable):

    @classmethod
    def load_arch_table(cls, path="/usr/share/dpkg"):
        # type: (Union[str, PathLike[str]]) -> DpkgArchTable
        cpu_table = StringIO(stubbed_cpu_table_data)
        tuple_table = StringIO(stubbed_tuple_table_data)
        return cls._from_file(tuple_table, cpu_table)