From ca00ac4ecda48b6e5ca716c6d674510e8b46ad86 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 3 Apr 2019 12:39:33 +0800 Subject: [PATCH] repo.py: fix TypeError --- repo.py | 2 +- utils.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/repo.py b/repo.py index 502a409..6225cd0 100755 --- a/repo.py +++ b/repo.py @@ -155,7 +155,7 @@ def _update(): if pkg_to_add.name.endswith(PKG_SUFFIX): sigfile = Path(f"{str(pkg_to_add)}.sig") if sigfile.exists(): - arch = get_pkg_details_from_name(pkg_to_add).arch + arch = get_pkg_details_from_name(pkg_to_add.name).arch pkg_nlocation = pkg_to_add.parent / '..' / 'www' / arch / pkg_to_add.name sig_nlocation = Path(f'{str(pkg_nlocation)}.sig') logger.info(f'Moving {pkg_to_add} to {pkg_nlocation}, {sigfile} to {sig_nlocation}') diff --git a/utils.py b/utils.py index bddb9ef..16c2ff0 100644 --- a/utils.py +++ b/utils.py @@ -102,6 +102,7 @@ class Pkg: self.arch = arch def get_pkg_details_from_name(name): + assert type(name) is str if name.endswith(f'pkg.tar.{PKG_COMPRESSION}'): m = re.match(r'(.+)-([^-]+)-([^-]+)-([^-]+)\.pkg\.tar\.\w+', name) assert m and m.groups() and len(m.groups()) == 4