Make all package fields optional

This commit is contained in:
coderkun 2020-05-17 11:34:44 +02:00
parent 3887959adf
commit e2008e8700

33
arch.py
View file

@ -44,17 +44,28 @@ class ArchDatabase:
s = df.read().decode('utf-8')
d = dict(item.split("\n")[:2] for item in s.split("\n\n")[:-1])
archPackage = ArchPackage(d["%NAME%"])
archPackage.set_filename(d["%FILENAME%"])
archPackage.set_version(d["%VERSION%"])
archPackage.set_desc(d["%DESC%"])
archPackage.set_csize(d["%CSIZE%"])
archPackage.set_isize(d["%ISIZE%"])
archPackage.set_url(d["%URL%"])
archPackage.set_license(d["%LICENSE%"])
archPackage.set_arch(d["%ARCH%"])
archPackage.set_builddate(d["%BUILDDATE%"])
archPackage.set_packager(d["%PACKAGER%"])
if "%NAME%" in d:
archPackage = ArchPackage(d["%NAME%"])
if "%FILENAME%" in d:
archPackage.set_filename(d["%FILENAME%"])
if "%VERSION%" in d:
archPackage.set_version(d["%VERSION%"])
if "%DESC%" in d:
archPackage.set_desc(d["%DESC%"])
if "%CSIZE%" in d:
archPackage.set_csize(d["%CSIZE%"])
if "%ISIZE%" in d:
archPackage.set_isize(d["%ISIZE%"])
if "%URL%" in d:
archPackage.set_url(d["%URL%"])
if "%LICENSE%" in d:
archPackage.set_license(d["%LICENSE%"])
if "%ARCH%" in d:
archPackage.set_arch(d["%ARCH%"])
if "%BUILDDATE%" in d:
archPackage.set_builddate(d["%BUILDDATE%"])
if "%PACKAGER%" in d:
archPackage.set_packager(d["%PACKAGER%"])
self.packages.append(archPackage)