Commit ad3924e5 authored by Vincent A's avatar Vincent A

weboob-repos: port to python3

tarfile.add doesn't take anymore 'exclude' keyword anymore but 'filter'
can do the same in both py2 and py3.
Also, subprocess returns bytes.
parent 0b0067e5
......@@ -149,7 +149,7 @@ class WeboobRepos(ReplApplication):
print('Create archive for %s' % name)
with closing(, 'w:gz')) as tar:
tar.add(module_path, arcname=name, exclude=self._archive_excludes)
tar.add(module_path, arcname=name, filter=self._archive_excludes)
tar_mtime = mktime(strptime(str(module.version), '%Y%m%d%H%M'))
os.utime(tarname, (tar_mtime, tar_mtime))
......@@ -164,7 +164,7 @@ class WeboobRepos(ReplApplication):
raise Exception('Unable to find the gpg executable.')
# Find out which keys are allowed to sign
fingerprints = [gpgline.strip(':').split(':')[-1]
fingerprints = [gpgline.decode('utf-8').strip(':').split(':')[-1]
for gpgline
in subprocess.Popen([
......@@ -174,7 +174,7 @@ class WeboobRepos(ReplApplication):
'--keyring', os.path.realpath(krname)],
if gpgline.startswith('fpr:')]
if gpgline.startswith(b'fpr:')]
# Find out the first secret key we have that is allowed to sign
secret_fingerprint = None
for fingerprint in fingerprints:
......@@ -214,11 +214,12 @@ class WeboobRepos(ReplApplication):
os.utime(sigpath, (file_mtime, file_mtime))
print('Signatures are up to date')
def _archive_excludes(self, filename):
def _archive_excludes(self, tarinfo):
filename =
# Skip *.pyc files in tarballs.
if filename.endswith('.pyc'):
return True
# Don't include *.png files in tarball
if filename.endswith('.png'):
return True
return False
return tarinfo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment