release-announcement: support older version of python-gnupg

In older versions of python-gnupg (at least in version 0.4.1 which is
the version that gets installed on Ubuntu 14.04) the GPG constructor
expects a parameter named `gnupghome` rather than `homedir` and will
fail with a TypeError.

Add handling of the TypeError and try again with the older parameter
name.

Change-Id: Ib5f9d652c59e48b6d76e1ddae48d4ae0cad850ba
This commit is contained in:
David Pursehouse 2018-02-27 16:54:46 +09:00
parent cba2cf5d5b
commit fdb5187705

View File

@ -142,7 +142,10 @@ def _main():
if not os.path.isdir(gpghome): if not os.path.isdir(gpghome):
print("Skipping signing due to missing gnupg home folder") print("Skipping signing due to missing gnupg home folder")
else: else:
gpg = GPG(homedir=gpghome) try:
gpg = GPG(homedir=gpghome)
except TypeError:
gpg = GPG(gnupghome=gpghome)
signed = gpg.sign(output) signed = gpg.sign(output)
filename = filename + ".asc" filename = filename + ".asc"
with open(filename, "w") as f: with open(filename, "w") as f: