catalog
This commit is contained in:
parent
3763dce133
commit
2e366f71f1
6 changed files with 25 additions and 37 deletions
27
remote.py
27
remote.py
|
@ -2,33 +2,16 @@ import os
|
|||
import requests
|
||||
|
||||
import arguments
|
||||
import catalog
|
||||
import hypertext
|
||||
import msys
|
||||
import repository
|
||||
|
||||
|
||||
class Remote(repository.Repository):
|
||||
def __init__(self):
|
||||
super().__init__(arguments.remote)
|
||||
self.load()
|
||||
|
||||
def load(self):
|
||||
archives = {}
|
||||
c = {}
|
||||
for architecture in self.architectures:
|
||||
subsystems = architecture.subsystems.keys()
|
||||
#
|
||||
c[architecture] = {}
|
||||
for subsystem in subsystems:
|
||||
location = os.path.join(self.location,
|
||||
architecture.subsystems[subsystem]
|
||||
.path,
|
||||
f'{subsystem}{msys.CATALOG}')
|
||||
binary = requests.get(location).content
|
||||
c[architecture][subsystem] = catalog.Catalog(binary)
|
||||
self.archives = archives
|
||||
self.catalogs = c
|
||||
def get_file(self, path):
|
||||
return requests.get(os.path.join(self.location, path)).content
|
||||
|
||||
def get_files(self, path):
|
||||
return hypertext.HyperText(os.path.join(self.location, path)).links
|
||||
|
@ -36,11 +19,5 @@ class Remote(repository.Repository):
|
|||
def __str__(self):
|
||||
lines = [
|
||||
super().__str__(),
|
||||
'Archives:',
|
||||
]
|
||||
for architecture, archive in reversed(sorted(self.archives.items())):
|
||||
lines.append(f'{architecture} → {archive}')
|
||||
lines.append('Subsystems:')
|
||||
for arch, ss in reversed(sorted(self.catalogs.items())):
|
||||
lines.append(f'{arch} → {list(ss.keys())}')
|
||||
return os.linesep.join(lines)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue