dotfiles

config files and scripts at HOME.
git clone git://git.ricketyspace.net/dotfiles.git
Log | Files | Refs

commit a53b3a26f5fdbdf9ca3746956dd00e642faa4117
parent 1bd7c502e265160396f3333edb12c4468af4b409
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Wed,  1 Jun 2016 19:19:29 +0000

.bin/gnupg-backup: Python 3 compatible now.

Diffstat:
.bin/gnupg-backup | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/.bin/gnupg-backup b/.bin/gnupg-backup @@ -55,7 +55,7 @@ def tar_it(f): "%s%s" % (path.basename(f), OUT_TAR_SUFFIX)) - print "creating tar ball %s..." % tar_ball + print(("creating tar ball {}...".format(tar_ball))) call(shlex.split("%s %s %s %s" % (TAR, OPT_TAR_CRT, tar_ball, f))) @@ -66,10 +66,10 @@ def encrypt_it(f): """ Encrypts file `f`. """ - blob = sha256(f).hexdigest() + blob = sha256(f.encode()).hexdigest() blob_path = path.join(path.dirname(f), blob) - print "blobbing %s to %s" % (f, blob_path) + print(("blobbing {} to {}".format(f, blob_path))) call(shlex.split("%s %s %s %s %s" % (GPG, OPT_GPG_OUT, blob_path, OPT_SYM_ENCRYPT, f))) @@ -94,12 +94,12 @@ def gnupg_export(fpr, directory, encrypt=False): "%s%s" % (DIR_PREFIX, fpr)) os.mkdir(export_dir) except OSError: - print "Looks like %s already exists" % export_dir + print(("Looks like {} already exists".format(export_dir))) # Export public key. pub_key = path.join(export_dir, OUT_PUB) - print "writing public key to %s" % pub_key + print(("writing public key to {}".format(pub_key))) with open(pub_key, 'w') as out: call(shlex.split("%s %s %s" % (GPG, OPT_EXPORT, fpr)), stdout=out) @@ -107,7 +107,7 @@ def gnupg_export(fpr, directory, encrypt=False): # Export secret key. sec_key = path.join(export_dir, OUT_SEC) - print "writing secret key to %s" % sec_key + print(("writing secret key to {}".format(sec_key))) with open(sec_key, 'w') as out: call(shlex.split("%s %s %s" % (GPG, OPT_EXPORT_SEC, fpr)), stdout=out) @@ -115,7 +115,7 @@ def gnupg_export(fpr, directory, encrypt=False): # Export trust. trust = path.join(export_dir, OUT_TRUST) - print "writing owner trust to %s" % trust + print(("writing owner trust to {}".format(trust))) with open(trust, 'w') as out: call(shlex.split("%s %s" % (GPG, OPT_EXPORT_TRUST)), stdout=out) @@ -147,5 +147,5 @@ if __name__ == "__main__": if path.exists(directory): gnupg_export(args.fpr, directory, args.encrypt) else: - print "%s does not exist. Exiting..." % (directory) + print(("{} does not exist. Exiting...".format(directory))) sys.exit(1)