appstream-python 0.8__py3-none-any.whl → 0.8.1__py3-none-any.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.
- appstream_python/Collection.py +19 -3
- appstream_python/Component.py +3 -3
- appstream_python/version.txt +1 -1
- {appstream_python-0.8.dist-info → appstream_python-0.8.1.dist-info}/METADATA +1 -1
- appstream_python-0.8.1.dist-info/RECORD +13 -0
- appstream_python-0.8.dist-info/RECORD +0 -13
- {appstream_python-0.8.dist-info → appstream_python-0.8.1.dist-info}/LICENSE +0 -0
- {appstream_python-0.8.dist-info → appstream_python-0.8.1.dist-info}/WHEEL +0 -0
- {appstream_python-0.8.dist-info → appstream_python-0.8.1.dist-info}/top_level.txt +0 -0
appstream_python/Collection.py
CHANGED
|
@@ -12,13 +12,24 @@ class AppstreamCollection:
|
|
|
12
12
|
def _add_appstream_tag(self, tag: etree.Element) -> None:
|
|
13
13
|
component_data = AppstreamComponent()
|
|
14
14
|
component_data.parse_component_tag(tag)
|
|
15
|
+
self.add_component(component_data)
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
def add_component(self, component: AppstreamComponent) -> None:
|
|
18
|
+
"Adds a AppstreamComponent to the collection"
|
|
19
|
+
self._components[component.id] = component
|
|
17
20
|
|
|
18
|
-
for i in
|
|
21
|
+
for i in component.categories:
|
|
19
22
|
if i not in self._categories:
|
|
20
23
|
self._categories[i] = []
|
|
21
|
-
self._categories[i].append(
|
|
24
|
+
self._categories[i].append(component.id)
|
|
25
|
+
|
|
26
|
+
def load_uncompressed_appstream_collection(self, path: str) -> None:
|
|
27
|
+
"Loads a uncompressed collection"
|
|
28
|
+
with open(path, "rb") as f:
|
|
29
|
+
root = etree.fromstring(f.read())
|
|
30
|
+
|
|
31
|
+
for i in root.findall("component"):
|
|
32
|
+
self._add_appstream_tag(i)
|
|
22
33
|
|
|
23
34
|
def load_compressed_appstream_collection(self, path: str) -> None:
|
|
24
35
|
"Loads a GZIP compressed collection"
|
|
@@ -72,5 +83,10 @@ class AppstreamCollection:
|
|
|
72
83
|
with open(path, "w", encoding="utf-8") as f:
|
|
73
84
|
f.write(etree.tostring(self.get_collection_tag(), pretty_print=True, xml_declaration=True, encoding="utf-8").decode("utf-8"))
|
|
74
85
|
|
|
86
|
+
def write_compressed_file(self, path: str) -> None:
|
|
87
|
+
"Writes a Uncompressed collection file"
|
|
88
|
+
with gzip.open(path, "wb") as f:
|
|
89
|
+
f.write(etree.tostring(self.get_collection_tag(), pretty_print=True, xml_declaration=True, encoding="utf-8"))
|
|
90
|
+
|
|
75
91
|
def __len__(self) -> int:
|
|
76
92
|
return len(self._components)
|
appstream_python/Component.py
CHANGED
|
@@ -357,7 +357,7 @@ class AppstreamComponent:
|
|
|
357
357
|
|
|
358
358
|
def get_available_languages(self) -> list[str]:
|
|
359
359
|
"Returns a list with all available languages of the Component"
|
|
360
|
-
lang_list = self.name.get_available_languages() + self.summary.get_available_languages() + self.
|
|
360
|
+
lang_list = self.name.get_available_languages() + self.summary.get_available_languages() + self.developer.name.get_available_languages()
|
|
361
361
|
return list(set(lang_list))
|
|
362
362
|
|
|
363
363
|
def _parse_relation_tag(self, tag: etree.Element) -> None:
|
|
@@ -409,11 +409,11 @@ class AppstreamComponent:
|
|
|
409
409
|
self.description.load_tags(description_tag)
|
|
410
410
|
|
|
411
411
|
metadata_license_tag = tag.find("metadata_license")
|
|
412
|
-
if metadata_license_tag is not None:
|
|
412
|
+
if metadata_license_tag is not None and metadata_license_tag.text is not None:
|
|
413
413
|
self.metadata_license = metadata_license_tag.text.strip()
|
|
414
414
|
|
|
415
415
|
project_license_tag = tag.find("project_license")
|
|
416
|
-
if project_license_tag is not None:
|
|
416
|
+
if project_license_tag is not None and project_license_tag.text is not None:
|
|
417
417
|
self.project_license = project_license_tag.text.strip()
|
|
418
418
|
|
|
419
419
|
categories_tag = tag.find("categories")
|
appstream_python/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.8
|
|
1
|
+
0.8.1
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
appstream_python/Collection.py,sha256=1WG1jyQCUEtaU8jv_iOjMZDibUjSSv9VkWkVUz9TtTA,3472
|
|
2
|
+
appstream_python/Component.py,sha256=8HxrSdkiMv3Ff-pfFLbMxxDC4A20gzIyE4g7QkxiHb0,24302
|
|
3
|
+
appstream_python/Release.py,sha256=sLQbv0T7FLYZYcfGivveVOKFD6rptoCAK0lbYCFYeiE,5409
|
|
4
|
+
appstream_python/Shared.py,sha256=zHeUDicNbuP_jXx3VTSNGuq7XFGUryZg0zMVCgGdXgo,13959
|
|
5
|
+
appstream_python/StandardConstants.py,sha256=-SzBKeXWFgY_6wc3SgptDlj88gOE_ztXBeBM3Xx3ko4,2376
|
|
6
|
+
appstream_python/__init__.py,sha256=eB0PvIoWrH0ZkNq2yY2h9xujdNqJMKmyM01KDpm6Yis,212
|
|
7
|
+
appstream_python/_helper.py,sha256=T1On8-taSPoKgpz9u8briuRO0uurcBL415o8g2Gc678,326
|
|
8
|
+
appstream_python/version.txt,sha256=qvZyHcN8QLQjOsz8CB8ld2_zvR0qS51c6nYNHCz4ZmU,6
|
|
9
|
+
appstream_python-0.8.1.dist-info/LICENSE,sha256=KHWQLS2VDTyyF0CMgSrCU2j758vzhIUXA4viB-DWlTI,1318
|
|
10
|
+
appstream_python-0.8.1.dist-info/METADATA,sha256=2f82WuWQSonypjpDg6zB4_Q25GJJ8IO2U4J1O7debok,1330
|
|
11
|
+
appstream_python-0.8.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
12
|
+
appstream_python-0.8.1.dist-info/top_level.txt,sha256=TEnvfaZcEAhAofLtB0lquKH1fwr9C-9dxpGN405dZiQ,17
|
|
13
|
+
appstream_python-0.8.1.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
appstream_python/Collection.py,sha256=D5Sx8M4YovOZ2OKkubgY0rxRA2IwhdXJqcFuAhhoIUE,2777
|
|
2
|
-
appstream_python/Component.py,sha256=BgFWQUv0XBsUZYp4WTuONXAmf80XE64Q7QG0x2PcD1U,24219
|
|
3
|
-
appstream_python/Release.py,sha256=sLQbv0T7FLYZYcfGivveVOKFD6rptoCAK0lbYCFYeiE,5409
|
|
4
|
-
appstream_python/Shared.py,sha256=zHeUDicNbuP_jXx3VTSNGuq7XFGUryZg0zMVCgGdXgo,13959
|
|
5
|
-
appstream_python/StandardConstants.py,sha256=-SzBKeXWFgY_6wc3SgptDlj88gOE_ztXBeBM3Xx3ko4,2376
|
|
6
|
-
appstream_python/__init__.py,sha256=eB0PvIoWrH0ZkNq2yY2h9xujdNqJMKmyM01KDpm6Yis,212
|
|
7
|
-
appstream_python/_helper.py,sha256=T1On8-taSPoKgpz9u8briuRO0uurcBL415o8g2Gc678,326
|
|
8
|
-
appstream_python/version.txt,sha256=_fJ28Bg8cXQoI7Bh9zQtWB5W3grxBkgzm1JSSeJu6U8,4
|
|
9
|
-
appstream_python-0.8.dist-info/LICENSE,sha256=KHWQLS2VDTyyF0CMgSrCU2j758vzhIUXA4viB-DWlTI,1318
|
|
10
|
-
appstream_python-0.8.dist-info/METADATA,sha256=6GzziBTwnxogHEFdDf_uxfUhsxG5EgiN-15nUJ7qOw4,1328
|
|
11
|
-
appstream_python-0.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
12
|
-
appstream_python-0.8.dist-info/top_level.txt,sha256=TEnvfaZcEAhAofLtB0lquKH1fwr9C-9dxpGN405dZiQ,17
|
|
13
|
-
appstream_python-0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|