python-alpm 0.3.0__cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
alpm/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ """Python bindings for the Arch Linux Package Management (ALPM) project."""
2
+
3
+ from ._native import alpm_srcinfo, alpm_types, ALPMError
4
+ from . import type_aliases
5
+
6
+ __all__ = ["alpm_types", "alpm_srcinfo", "type_aliases", "ALPMError"]
alpm/_native.abi3.so ADDED
Binary file
alpm/_native.pyi ADDED
@@ -0,0 +1,4 @@
1
+ from alpm import alpm_types, alpm_srcinfo
2
+ from alpm.alpm_types import ALPMError
3
+
4
+ __all__ = ["alpm_types", "alpm_srcinfo", "ALPMError"]
@@ -0,0 +1,20 @@
1
+ """A module for parsing and linting of ALPM SRCINFO files."""
2
+
3
+ from . import error, source_info, schema
4
+ from .error import SourceInfoError
5
+ from .schema import SourceInfoSchema
6
+ from .source_info import source_info_from_file, source_info_from_str
7
+ from .source_info.v1 import SourceInfoV1
8
+ from .source_info.v1.merged import MergedPackage
9
+
10
+ __all__ = [
11
+ "SourceInfoError",
12
+ "error",
13
+ "source_info",
14
+ "SourceInfoV1",
15
+ "MergedPackage",
16
+ "schema",
17
+ "SourceInfoSchema",
18
+ "source_info_from_str",
19
+ "source_info_from_file",
20
+ ]
@@ -0,0 +1,8 @@
1
+ """Exceptions used by alpm_srcinfo module."""
2
+
3
+ class SourceInfoError(Exception):
4
+ """The high-level exception that can occur when using alpm_srcinfo module."""
5
+
6
+ __all__ = [
7
+ "SourceInfoError",
8
+ ]
@@ -0,0 +1,70 @@
1
+ """Schemas for SRCINFO data."""
2
+
3
+ from pathlib import Path
4
+ from typing import Union, TYPE_CHECKING
5
+
6
+ if TYPE_CHECKING:
7
+ from alpm.alpm_types import SchemaVersion
8
+
9
+ class SourceInfoSchema:
10
+ """SRCINFO schema.
11
+
12
+ The schema of a SRCINFO refers to the minimum required sections and keywords, as
13
+ well as the complete set of available keywords in a specific version.
14
+ """
15
+
16
+ def __init__(self, version: Union[str, "SchemaVersion"]) -> None:
17
+ """Create a SourceInfoSchema from SchemaVersion or its string representation.
18
+
19
+ Args:
20
+ version (Union[str, SchemaVersion]): either a SchemaVersion or a string
21
+ representation of SchemaVersion.
22
+
23
+ Raises:
24
+ ALPMError: if the string representation of the version is invalid.
25
+ SourceInfoError: if there is no corresponding schema for the provided major
26
+ version.
27
+
28
+ """
29
+
30
+ @staticmethod
31
+ def derive_from_str(srcinfo: str) -> "SourceInfoSchema":
32
+ """Derive the schema from a string containing SRCINFO data.
33
+
34
+ Args:
35
+ srcinfo (str): The srcinfo string to derive the schema from.
36
+
37
+ Returns:
38
+ SourceInfoSchema: The derived schema.
39
+
40
+ Raises:
41
+ SourceInfoError: if the srcinfo string cannot be parsed.
42
+
43
+ """
44
+
45
+ @staticmethod
46
+ def derive_from_file(path: Union[str, Path]) -> "SourceInfoSchema":
47
+ """Derive the schema from a file containing SRCINFO data.
48
+
49
+ Args:
50
+ path (Union[str, Path]): The path to the file containing SRCINFO data.
51
+
52
+ Returns:
53
+ SourceInfoSchema: The derived schema.
54
+
55
+ Raises:
56
+ SourceInfoError: if the file cannot be read or parsed.
57
+
58
+ """
59
+
60
+ @property
61
+ def version(self) -> "SchemaVersion":
62
+ """The schema version."""
63
+
64
+ def __str__(self) -> str: ...
65
+ def __repr__(self) -> str: ...
66
+ def __eq__(self, other: object) -> bool: ...
67
+
68
+ __all__ = [
69
+ """SourceInfoSchema""",
70
+ ]
@@ -0,0 +1,54 @@
1
+ """Data representations and integrations for reading of SRCINFO data."""
2
+
3
+ from pathlib import Path
4
+ from typing import Optional, TYPE_CHECKING, Union
5
+
6
+ from . import v1
7
+
8
+ if TYPE_CHECKING:
9
+ from alpm.alpm_srcinfo.schema import SourceInfoSchema
10
+ from alpm.type_aliases import SourceInfo
11
+
12
+ def source_info_from_str(
13
+ s: str, schema: Optional["SourceInfoSchema"] = None
14
+ ) -> "SourceInfo":
15
+ """Create a SourceInfo object from a string.
16
+
17
+ Optionally validated using a SourceInfoSchema.
18
+
19
+ If schema is None, attempts to detect the SourceInfoSchema from s.
20
+
21
+ Args:
22
+ s (str): The srcinfo string to parse.
23
+ schema (Optional[SourceInfoSchema]): The schema to validate against.
24
+
25
+ Returns:
26
+ SourceInfo: The parsed SourceInfo object.
27
+
28
+ Raises:
29
+ SourceInfoError: If the string is not a valid SRCINFO.
30
+
31
+ """
32
+
33
+ def source_info_from_file(
34
+ path: Union[str, Path], schema: Optional["SourceInfoSchema"] = None
35
+ ) -> "SourceInfo":
36
+ """Create a SourceInfo object from a file.
37
+
38
+ Optionally validated using a SourceInfoSchema.
39
+
40
+ If schema is None, attempts to detect the SourceInfoSchema from the file contents.
41
+
42
+ Args:
43
+ path (Union[str, Path]): The path to the file containing SRCINFO data.
44
+ schema (Optional[SourceInfoSchema]): The schema to validate against.
45
+
46
+ Returns:
47
+ SourceInfo: The parsed SourceInfo object.
48
+
49
+ Raises:
50
+ SourceInfoError: If the file cannot be read or is not a valid SRCINFO.
51
+
52
+ """
53
+
54
+ __all__ = ["v1", "source_info_from_str", "source_info_from_file"]
@@ -0,0 +1,102 @@
1
+ """Contains the second parsing and linting pass."""
2
+
3
+ from pathlib import Path
4
+ from typing import Union
5
+
6
+ from . import merged, package, package_base
7
+ from .package import Package
8
+ from .package_base import PackageBase
9
+ from .merged import MergedPackage
10
+ from alpm.alpm_types import Architecture
11
+
12
+ class SourceInfoV1:
13
+ """The representation of SRCINFO data.
14
+
15
+ Provides access to a PackageBase which tracks all data in a pkgbase section and a
16
+ list of Package instances that provide the accumulated data of all pkgname sections.
17
+
18
+ This is the entry point for parsing SRCINFO files. Once created,
19
+ packages_for_architecture method can be used to create usable MergedPackages.
20
+ """
21
+
22
+ __hash__ = None # type: ignore
23
+
24
+ def __init__(self, content: str):
25
+ """Create SourceInfoV1 from a string representation.
26
+
27
+ Args:
28
+ content (str): The content of a SRCINFO as a string.
29
+
30
+ Raises:
31
+ SourceInfoError: If the content is not a valid SRCINFO representation.
32
+
33
+ """
34
+
35
+ @staticmethod
36
+ def from_file(path: Union[Path, str]) -> "SourceInfoV1":
37
+ """Read the file at the specified path and convert it into a SourceInfoV1.
38
+
39
+ Args:
40
+ path (Path | str): The path to the SRCINFO file.
41
+
42
+ Returns:
43
+ SourceInfoV1: The SourceInfoV1 instance created from the file content.
44
+
45
+ Raises:
46
+ SourceInfoError: If the file content is not a valid SRCINFO representation.
47
+
48
+ """
49
+
50
+ @staticmethod
51
+ def from_pkgbuild(path: Union[Path, str]) -> "SourceInfoV1":
52
+ """Create a SourceInfoV1 from a PKGBUILD file.
53
+
54
+ Args:
55
+ path (Path | str): The path to the PKGBUILD file.
56
+
57
+ Returns:
58
+ SourceInfoV1: The SourceInfoV1 instance created from the PKGBUILD file.
59
+
60
+ Raises:
61
+ SourceInfoError: If the PKGBUILD file cannot be parsed or is invalid.
62
+
63
+ """
64
+
65
+ @property
66
+ def base(self) -> "PackageBase":
67
+ """The information of the pkgbase section."""
68
+
69
+ @property
70
+ def packages(self) -> list["Package"]:
71
+ """The information of the pkgname sections."""
72
+
73
+ def as_srcinfo(self) -> str:
74
+ """Get a string representation in valid SRCINFO format.
75
+
76
+ Returns:
77
+ str: The string representation of the SourceInfoV1 instance.
78
+
79
+ """
80
+
81
+ def packages_for_architecture(
82
+ self, architecture: "Architecture"
83
+ ) -> list["MergedPackage"]:
84
+ """Get a list of all packages for architecture.
85
+
86
+ Args:
87
+ architecture (Architecture): The architecture to get packages for.
88
+
89
+ Returns:
90
+ list[MergedPackage]: A list of all packages for the given architecture.
91
+
92
+ """
93
+
94
+ def __str__(self) -> str: ...
95
+ def __repr__(self) -> str: ...
96
+
97
+ __all__ = [
98
+ "SourceInfoV1",
99
+ "merged",
100
+ "package",
101
+ "package_base",
102
+ ]
@@ -0,0 +1,188 @@
1
+ """Provides fully resolved package metadata derived from SRCINFO data."""
2
+
3
+ from typing import Optional, Union
4
+ from pathlib import Path
5
+
6
+ from alpm.alpm_srcinfo.source_info.v1.package import Package
7
+ from alpm.alpm_srcinfo.source_info.v1.package_base import PackageBase
8
+ from alpm.type_aliases import MakepkgOption, OpenPGPIdentifier, RelationOrSoname
9
+ from alpm.alpm_types import (
10
+ Url,
11
+ License,
12
+ Architecture,
13
+ FullVersion,
14
+ PackageRelation,
15
+ OptionalDependency,
16
+ Source,
17
+ SkippableBlake2b512Checksum,
18
+ SkippableMd5Checksum,
19
+ SkippableSha1Checksum,
20
+ SkippableSha224Checksum,
21
+ SkippableSha256Checksum,
22
+ SkippableSha384Checksum,
23
+ SkippableSha512Checksum,
24
+ )
25
+
26
+ class MergedPackage:
27
+ """Fully resolved metadata of a single package based on SRCINFO data.
28
+
29
+ This struct incorporates all PackageBase properties and the Package specific
30
+ overrides in an architecture-specific representation of a package. It can be
31
+ created using SourceInfoV1.packages_for_architecture.
32
+ """
33
+
34
+ def __init__(
35
+ self,
36
+ architecture: "Architecture",
37
+ base: "PackageBase",
38
+ package_or_name: Union[Package | str],
39
+ ):
40
+ """Create architecture-specific metadata representation of a package.
41
+
42
+ Based on the provided parameters can either create a fully resolved or a basic
43
+ (incomplete) MergedPackage.
44
+
45
+ Args:
46
+ architecture (Architecture): Defines the architecture for which to create
47
+ the representation.
48
+ base (PackageBase): The package base which provides the initial data.
49
+ package_or_name (Union[Package, str]): Either the Package from which to
50
+ derive the metadata for a fully resolved MergedPackage, or a name of
51
+ the package for a basic, incomplete representation of a package.
52
+
53
+ Raises:
54
+ ALPMError: If the provided name is not valid.
55
+
56
+ """
57
+
58
+ @property
59
+ def name(self) -> str:
60
+ """The alpm-package-name for the package."""
61
+
62
+ @property
63
+ def description(self) -> Optional[str]:
64
+ """The description for the package."""
65
+
66
+ @property
67
+ def url(self) -> Optional["Url"]:
68
+ """The upstream URL for the package."""
69
+
70
+ @property
71
+ def licenses(self) -> list["License"]:
72
+ """Licenses that apply to the package."""
73
+
74
+ @property
75
+ def architecture(self) -> "Architecture":
76
+ """Alpm-architecture for the package."""
77
+
78
+ @property
79
+ def changelog(self) -> Optional[Path]:
80
+ """Path to a changelog file for the package."""
81
+
82
+ @property
83
+ def install(self) -> Optional[Path]:
84
+ """Path to an alpm-install-scriptlet for the package."""
85
+
86
+ @property
87
+ def groups(self) -> list[str]:
88
+ """Alpm-package-groups the package is part of."""
89
+
90
+ @property
91
+ def options(self) -> list["MakepkgOption"]:
92
+ """Build tool options used when building the package."""
93
+
94
+ @property
95
+ def backups(self) -> list[Path]:
96
+ """Paths to files in the package that should be backed up."""
97
+
98
+ @property
99
+ def version(self) -> "FullVersion":
100
+ """The full version of the package."""
101
+
102
+ @property
103
+ def pgp_fingerprints(self) -> list["OpenPGPIdentifier"]:
104
+ """OpenPGPIdentifiers used for the verification of upstream sources."""
105
+
106
+ @property
107
+ def dependencies(self) -> list["RelationOrSoname"]:
108
+ """The list of run-time dependencies."""
109
+
110
+ @property
111
+ def optional_dependencies(self) -> list["OptionalDependency"]:
112
+ """The list of optional dependencies."""
113
+
114
+ @property
115
+ def provides(self) -> list["RelationOrSoname"]:
116
+ """The list of provisions."""
117
+
118
+ @property
119
+ def conflicts(self) -> list["PackageRelation"]:
120
+ """The list of conflicts."""
121
+
122
+ @property
123
+ def replaces(self) -> list["PackageRelation"]:
124
+ """The list of replacements."""
125
+
126
+ @property
127
+ def check_dependencies(self) -> list["PackageRelation"]:
128
+ """The list of test dependencies."""
129
+
130
+ @property
131
+ def make_dependencies(self) -> list["PackageRelation"]:
132
+ """The list of build dependencies."""
133
+
134
+ @property
135
+ def sources(self) -> list["MergedSource"]:
136
+ """The list of sources for the package."""
137
+
138
+ @property
139
+ def no_extracts(self) -> list[str]:
140
+ """The list of sources for the package that are not extracted."""
141
+
142
+ def __str__(self) -> str: ...
143
+ def __repr__(self) -> str: ...
144
+
145
+ class MergedSource:
146
+ """A merged representation of source related information.
147
+
148
+ SRCINFO provides this info as separate lists. This struct resolves that list
149
+ representation and provides a convenient aggregated representation for a single
150
+ source.
151
+ """
152
+
153
+ @property
154
+ def source(self) -> "Source":
155
+ """The source."""
156
+
157
+ @property
158
+ def b2_checksum(self) -> Optional[SkippableBlake2b512Checksum]:
159
+ """The optional Blake2 hash digest of source."""
160
+
161
+ @property
162
+ def md5_checksum(self) -> Optional[SkippableMd5Checksum]:
163
+ """The optional MD-5 hash digest of source."""
164
+
165
+ @property
166
+ def sha1_checksum(self) -> Optional[SkippableSha1Checksum]:
167
+ """The optional SHA-1 hash digest of source."""
168
+
169
+ @property
170
+ def sha224_checksum(self) -> Optional[SkippableSha224Checksum]:
171
+ """The optional SHA-224 hash digest of source."""
172
+
173
+ @property
174
+ def sha256_checksum(self) -> Optional[SkippableSha256Checksum]:
175
+ """The optional SHA-256 hash digest of source."""
176
+
177
+ @property
178
+ def sha384_checksum(self) -> Optional[SkippableSha384Checksum]:
179
+ """The optional SHA-384 hash digest of source."""
180
+
181
+ @property
182
+ def sha512_checksum(self) -> Optional[SkippableSha512Checksum]:
183
+ """The optional SHA-512 hash digest of source."""
184
+
185
+ __all__ = [
186
+ "MergedPackage",
187
+ "MergedSource",
188
+ ]