srlp/distribution.py

24 lines
629 B
Python
Raw Normal View History

2021-10-10 15:22:02 +02:00
import os
2021-10-10 20:40:14 +02:00
ARCHIVE = '.tar.xz'
2021-10-10 16:50:15 +02:00
DISTRIBUTION = 'distrib'
2021-10-10 15:22:02 +02:00
class Distribution:
def __init__(self, architecture):
self.architecture = architecture
2021-10-10 21:44:54 +02:00
self.path = os.path.join(DISTRIBUTION, self.architecture.name)
2021-10-10 20:27:48 +02:00
self.load()
def load(self):
files = self.architecture.repository.get_files(self.path)
2021-10-10 20:40:14 +02:00
self.archives = [f for f in files if f.endswith(ARCHIVE)]
self.archive = self.archives[-1]
2021-10-10 15:22:02 +02:00
def __str__(self):
lines = [
f'Architecture: {self.architecture.name}',
2021-10-10 16:50:15 +02:00
f' Path: {self.path}',
2021-10-10 15:22:02 +02:00
]
return os.linesep.join(lines)