mrmp/distribution.py

24 lines
629 B
Python
Raw Normal View History

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