This commit is contained in:
cronekorkn 2022-10-18 15:37:46 +02:00
parent 2446f36375
commit 01735e4c7a
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw

View file

@ -11,9 +11,10 @@ class AptSource():
# parse options, which are optional # parse options, which are optional
if search(r'\[.*\]', string): if search(r'\[.*\]', string):
self.options = { self.options = {
k:v.split(',') for k,v in ( k:v.split(',')
e.split('=') for e in search(r'\[(.*)\]', string)[1].split() for k,v in (
) e.split('=') for e in search(r'\[(.*)\]', string)[1].split()
)
} }
string_without_options = sub(r'\[.*\]', '', string) string_without_options = sub(r'\[.*\]', '', string)
else: else:
@ -26,7 +27,7 @@ class AptSource():
self.url = urlparse(parts[1]) self.url = urlparse(parts[1])
self.suite = parts[2] self.suite = parts[2]
self.components = parts[3:] self.components = parts[3:]
def __str__(self): def __str__(self):
parts = [ parts = [
self.type, self.type,
@ -47,13 +48,13 @@ class AptSource():
) )
) )
) )
return ' '.join(parts) return ' '.join(parts)
def __eq__(self, other): def __eq__(self, other):
return str(self) == str(other) return str(self) == str(other)
def __lt__(self, other): def __lt__(self, other):
return str(self) < str(other) return str(self) < str(other)