packages
This commit is contained in:
parent
279cab318a
commit
e90a4396fa
3 changed files with 30 additions and 10 deletions
13
package.py
13
package.py
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
CHARSET = 'u8'
|
||||
import msys
|
||||
|
||||
KEY = '%'
|
||||
SEPARATOR = f'{os.linesep}{os.linesep}'
|
||||
|
||||
|
@ -8,7 +9,7 @@ SEPARATOR = f'{os.linesep}{os.linesep}'
|
|||
class Package:
|
||||
def __init__(self, package, files):
|
||||
for binary in [package, files]:
|
||||
text = binary.decode(CHARSET).strip()
|
||||
text = binary.decode(msys.CHARSET).strip()
|
||||
for item in text.split(SEPARATOR):
|
||||
line, *lines = item.split(os.linesep)
|
||||
key = line.split(KEY)[1].lower()
|
||||
|
@ -17,3 +18,11 @@ class Package:
|
|||
else:
|
||||
value = lines
|
||||
setattr(self, key, value)
|
||||
|
||||
def __str__(self):
|
||||
lines = [
|
||||
f'Name: {self.name}',
|
||||
f'Size: {self.csize}',
|
||||
f'Hash: {self.sha256sum}',
|
||||
]
|
||||
return os.linesep.join(lines)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue