architectures

This commit is contained in:
Marc Beninca 2021-10-10 20:04:45 +02:00 committed by Marc Beninca
parent 28369f5813
commit 68c15d9c39
3 changed files with 11 additions and 10 deletions

View file

@ -1,6 +1,7 @@
import argparse import argparse
import os import os
import architecture
import msys import msys
import subsystem import subsystem
@ -48,7 +49,8 @@ action to perform onto msys repository
msys remote repository's location msys remote repository's location
''') ''')
sync.add_argument(f'-{ARCHITECTURES[0]}', f'--{ARCHITECTURES}', type=str, sync.add_argument(f'-{ARCHITECTURES[0]}', f'--{ARCHITECTURES}', type=str,
nargs='+', choices=msys.ARCHITECTURES, help='''\ nargs='+', choices=architecture.ARCHITECTURES.keys(),
help='''\
list of architectures to sync list of architectures to sync
''') ''')
sync.add_argument(f'-{SUBSYSTEMS[0]}', f'--{SUBSYSTEMS}', type=str, sync.add_argument(f'-{SUBSYSTEMS[0]}', f'--{SUBSYSTEMS}', type=str,

View file

@ -1,7 +1,8 @@
import arguments
import datetime import datetime
import os import os
import architecture
import arguments
import distribution import distribution
import msys import msys
import repository import repository
@ -18,14 +19,14 @@ class Local(repository.Repository):
self.location, distribution.DISTRIBUTION) self.location, distribution.DISTRIBUTION)
d = {} d = {}
_, architectures, _ = next(os.walk(distro)) _, architectures, _ = next(os.walk(distro))
for architecture in [a for a in architectures for arch in [a for a in architectures
if a in msys.ARCHITECTURES]: if a in architecture.ARCHITECTURES.keys()]:
directory = os.path.join(distro, architecture) directory = os.path.join(distro, arch)
_, _, files = next(os.walk(directory)) _, _, files = next(os.walk(directory))
archives = sorted([file for file in files archives = sorted([file for file in files
if file.endswith(msys.ARCHIVE)]) if file.endswith(msys.ARCHIVE)])
archive = archives[-1] archive = archives[-1]
d[architecture] = archive d[arch] = archive
self.archives = d self.archives = d
def get_temporary(self): def get_temporary(self):
@ -38,6 +39,6 @@ class Local(repository.Repository):
super().__str__(), super().__str__(),
'Archives:', 'Archives:',
] ]
for architecture, archive in reversed(sorted(self.archives.items())): for arch, archive in reversed(sorted(self.archives.items())):
lines.append(f'{architecture}{archive}') lines.append(f'{arch}{archive}')
return os.linesep.join(lines) return os.linesep.join(lines)

View file

@ -3,5 +3,3 @@ ARCHITECTURE = 'x86_64'
CATALOG = '.files' CATALOG = '.files'
CHARSET = 'u8' CHARSET = 'u8'
REPOSITORY = 'https://repo.msys2.org' REPOSITORY = 'https://repo.msys2.org'
ARCHITECTURES = [ARCHITECTURE, 'i686']