location,str
This commit is contained in:
parent
3707f42b77
commit
9cd6155f8c
4 changed files with 21 additions and 11 deletions
7
local.py
7
local.py
|
@ -8,13 +8,13 @@ import repository
|
||||||
|
|
||||||
class Local(repository.Repository):
|
class Local(repository.Repository):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.directory = args[arguments.DIRECTORY]
|
super().__init__(args[arguments.DIRECTORY])
|
||||||
self.temporary = args[arguments.TEMPORARY]
|
self.temporary = args[arguments.TEMPORARY]
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
distribution = os.path.join(
|
distribution = os.path.join(
|
||||||
self.directory, msys.DISTRIBUTION)
|
self.location, msys.DISTRIBUTION)
|
||||||
d = {}
|
d = {}
|
||||||
_, architectures, _ = next(os.walk(distribution))
|
_, architectures, _ = next(os.walk(distribution))
|
||||||
for architecture in [a for a in architectures
|
for architecture in [a for a in architectures
|
||||||
|
@ -34,8 +34,7 @@ class Local(repository.Repository):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
lines = [
|
lines = [
|
||||||
f'Directory: {self.directory}',
|
super().__str__(),
|
||||||
f' → {os.path.realpath(self.directory)}',
|
|
||||||
'Archives:',
|
'Archives:',
|
||||||
]
|
]
|
||||||
for architecture, archive in reversed(sorted(self.archives.items())):
|
for architecture, archive in reversed(sorted(self.archives.items())):
|
||||||
|
|
|
@ -10,7 +10,7 @@ import repository
|
||||||
|
|
||||||
class Remote(repository.Repository):
|
class Remote(repository.Repository):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.location = args[arguments.REMOTE]
|
super().__init__(args[arguments.REMOTE])
|
||||||
self.architectures = args[arguments.ARCHITECTURES]
|
self.architectures = args[arguments.ARCHITECTURES]
|
||||||
self.subsystems = args[arguments.SUBSYSTEMS]
|
self.subsystems = args[arguments.SUBSYSTEMS]
|
||||||
self.load()
|
self.load()
|
||||||
|
@ -36,8 +36,10 @@ class Remote(repository.Repository):
|
||||||
self.catalogs = c
|
self.catalogs = c
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
lines = [f'Location: {self.location}',
|
lines = [
|
||||||
'Archives:']
|
super().__str__(),
|
||||||
|
'Archives:',
|
||||||
|
]
|
||||||
for architecture, archive in reversed(sorted(self.archives.items())):
|
for architecture, archive in reversed(sorted(self.archives.items())):
|
||||||
lines.append(f'{architecture} → {archive}')
|
lines.append(f'{architecture} → {archive}')
|
||||||
lines.append('Subsystems:')
|
lines.append('Subsystems:')
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Repository:
|
class Repository:
|
||||||
def __init__(self):
|
def __init__(self, location):
|
||||||
pass
|
self.location = location
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
lines = [
|
||||||
|
f'Location: {self.location}',
|
||||||
|
]
|
||||||
|
return os.linesep.join(lines)
|
||||||
|
|
|
@ -26,12 +26,12 @@ class Synchronization:
|
||||||
os.path.join(self.remote.location, path),
|
os.path.join(self.remote.location, path),
|
||||||
package.name,
|
package.name,
|
||||||
package.csize,
|
package.csize,
|
||||||
os.path.join(self.repository.directory, path),
|
os.path.join(self.repository.location, path),
|
||||||
package.sha256sum,
|
package.sha256sum,
|
||||||
)
|
)
|
||||||
print()
|
print()
|
||||||
print(f)
|
print(f)
|
||||||
tmp = os.path.join(self.repository.directory,
|
tmp = os.path.join(self.repository.location,
|
||||||
self.repository.get_temporary())
|
self.repository.get_temporary())
|
||||||
os.makedirs(tmp)
|
os.makedirs(tmp)
|
||||||
# clean temporary directory
|
# clean temporary directory
|
||||||
|
|
Loading…
Reference in a new issue