Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move GPG signing to function

  • Loading branch information...
commit 7ccf5f0bc53ff1cdb255beb5ea0db541320b3ab8 1 parent d613925
@dregad dregad authored
Showing with 22 additions and 16 deletions.
  1. +22 −16 buildrelease.py
View
38 buildrelease.py
@@ -57,6 +57,19 @@ def usage():
#end usage()
+def gpg_sign_tarball(filename):
+ ''' Sign the file using GPG '''
+
+ gpgsign = "gpg -b -a %s" + path.abspath(path.join(os.curdir, filename))
+ try:
+ subprocess.check_call(gpgsign % '--batch ', shell=True)
+ except subprocess.CalledProcessError:
+ print "WARNING: GPG signature failed; to sign manually, run\n" \
+ " %s" % (
+ gpgsign % ''
+ )
+
+
def main():
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options)
@@ -187,32 +200,25 @@ def main():
shell=True
)
- # Create tarballs
+ # Create tarballs and sign them
print "Creating release tarballs..."
os.chdir(release_path)
tarball_ext = ("tar.gz", "zip")
for ext in tarball_ext:
+ tarball = "%s.%s" % (release_name, ext)
+ print " " + tarball
+
if ext == "tar.gz":
- tar_cmd = "tar czf"
+ tar_cmd = "tar -czf"
elif ext == "zip":
tar_cmd = "zip -rq"
- tar_cmd += " %(rel)s.%(ext)s %(rel)s"
+ tar_cmd += " %s %s"
- print " " + ext
- subprocess.call(
- tar_cmd % {"rel": release_name, "ext": ext},
- shell=True
- )
+ subprocess.call(tar_cmd % (tarball, release_name), shell=True)
- # Sign tarballs
- print "Signing tarballs"
- gpgsign = "gpg -b -a --batch %s"
-
- for ext in tarball_ext:
- tarball = "%s.%s " % (release_name, ext)
- print " " + tarball
- subprocess.call(gpgsign % tarball, shell=True)
+ print " Signing the tarball"
+ gpg_sign_tarball(tarball)
# Generate checksums
print "Generating checksums..."
Please sign in to comment.
Something went wrong with that request. Please try again.