python: Delete trailing whitespace.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
This commit is contained in:
Justus Winter 2016-05-10 13:30:30 +02:00
parent 000dbb5b9a
commit aade53a12b
14 changed files with 74 additions and 78 deletions

View File

@ -22,7 +22,7 @@ Authors
* Martin Albrecht, `PyME 0.9+ <https://bitbucket.org/malb/pyme>`_, 2014 to present.
* Ben McGinnes, `PyME Python 3 Port <https://git.gnupg.org/gpgme.git/lang/py3-pyme>`_, 2015 to present.
------------
Mailing List
------------

View File

@ -4,7 +4,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Wed May 6 03:04:19 2015 +1000
Merge pull request #4 from Hasimir/master
history
commit 2036f1a0a670a0561993e195c458059220b36114
@ -19,7 +19,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Wed May 6 02:52:23 2015 +1000
Added a short history
* A (very) brief summary of the project's history since 2002.
* Deals with why the commit log in the GPGME repo does not include the
history of PyME.
@ -36,7 +36,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Wed May 6 02:21:34 2015 +1000
Merge pull request #3 from Hasimir/master
Version release preparation
commit 7c37a27a6845c58222d4d947c2efbe38e955b612
@ -51,7 +51,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Wed May 6 02:09:44 2015 +1000
TODO update
* Removed reference to GitHub, replaced with impending new home at gnupg.org.
docs/TODO.rst | 4 ++--
@ -62,7 +62,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Wed May 6 02:00:44 2015 +1000
Version bump
* Bumped version number to 0.9.1 to keep it somewhat in line with the
existing PyME project, even though there will be some divergence at
some point (or even re-merging, depending on how many of the Python 3
@ -80,7 +80,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Wed May 6 01:48:01 2015 +1000
README preparation.
* Changes in preparation for impending move of code to the GnuPG git
server as a part of GPGME.
@ -92,7 +92,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Wed May 6 01:43:53 2015 +1000
TODO moved to docs
* As it says.
TODO.rst | 25 -------------------------
@ -114,7 +114,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 14:59:44 2015 +1000
Merge pull request #2 from Hasimir/master
Minor editing.
commit 44837f6e50fc539c86aef1f75a6a3538b02029ea
@ -122,7 +122,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 14:56:55 2015 +1000
Minor editing.
* Fixed another URL.
* Changed Py3 version's version number to v0.9.1-beta0.
@ -135,7 +135,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 14:26:11 2015 +1000
Merge pull request #1 from Hasimir/master
Links
commit 48eb1856cb0739cc9f0b9084da9d965e1fc7fddd
@ -143,7 +143,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 14:22:30 2015 +1000
Links
* Fixed URLs for authors.
* Updated my entry to point to github location.
** I strongly suspect the result of this work will be concurrent
@ -157,9 +157,9 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 11:29:00 2015 +1000
Explicit over Implicit ...
... isn't just for code.
* Removed the 2to3 working directory and its contents.
* Made the README.rst file a little more clear that this branch is for
Python 3 (set Python 3.2 as a fairly arbitrary requirement for the
@ -176,7 +176,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 11:19:41 2015 +1000
Added authors.
* In alphabetical order.
* Mine will need updating once Martin and I have decided what to do
regarding the two main branches.
@ -189,7 +189,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 10:23:00 2015 +1000
Docs and other things.
* Now able to import pyme.core without error, indicates port process is
successful.
* Code is *not* compatible with the Python 2 version.
@ -227,7 +227,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 10:08:22 2015 +1000
Bytes vs. Unicode
* Trying PyBytes instead of PyUnicode.
gpgme.i | 14 +++++++-------
@ -239,7 +239,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 09:22:58 2015 +1000
String to Unicode
* Replaced all instances of PyString with PyUnicode (and hoping there's
no byte data in there).
@ -252,7 +252,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 09:17:06 2015 +1000
PyInt_AsLong
* Replaced all instances of PyInt with PyLong, as per C API docs.
gpgme.i | 4 ++--
@ -264,7 +264,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 05:59:36 2015 +1000
Import correction
* Once pygpgme.py is generated and moved, it will be in the right
directory for the explicit "from . import pygpgme" to be correct.
@ -303,10 +303,10 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 04:53:21 2015 +1000
Pet Peeve
def pet_peeve(self):
peeve = print("people who don't press return after a colon!")
FFS!
pyme/core.py | 5 +++--
@ -371,7 +371,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sun May 3 03:51:48 2015 +1000
Linking swig to py3
* Changed the swig invocations to run with the -python -py3 flags explicitly.
Makefile | 4 ++--
@ -383,7 +383,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 11:12:00 2015 +1000
String fun
* streamlined confdata details, including decoding strom binary to string.
setup.py | 4 +---
@ -394,7 +394,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 10:46:59 2015 +1000
Open File
* Removed deprecated file() and replaced with open().
examples/PyGtkGpgKeys.py | 2 +-
@ -407,7 +407,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 10:36:15 2015 +1000
print() fix
* Makefile includes a python print, changed from statement to function.
Makefile | 2 +-
@ -418,7 +418,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 10:28:42 2015 +1000
Updated Makefile
* set make to use python3 instead.
* This will mean a successful port may need to be maintained seperately
from the original python2 code instead of merged, but ought to be able
@ -434,7 +434,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 10:15:20 2015 +1000
Env and a little license issue
* Updated all the /usr/bin/env paths to point to python3.
* Also fixed the hard coded /usr/bin/python paths.
* Updated part of setup.py which gave the impression this package was
@ -463,7 +463,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 08:50:54 2015 +1000
Removed extraneous files.
* The two .bak files.
pyme/errors.py.bak | 46 ---------------------
@ -475,7 +475,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 08:19:37 2015 +1000
Added TODO.org
* TODO list in Emacs org-mode.
* Will eventually be removed along with this entire directory when the
porting process is complete.
@ -488,7 +488,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 07:58:40 2015 +1000
2to3 conversion of remaining files
* Ran the extended version against all the unmodified python files.
* Only pyme/errors.py required additional work.
@ -502,7 +502,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Sat May 2 07:50:39 2015 +1000
2to3 conversion of setup.py
* Ran extended 2to3 command to produce python 3 code for setup.py.
* Effectively testing for what to run against the other originally
unmodified py2 files.
@ -517,7 +517,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Fri May 1 21:50:07 2015 +1000
Removing 2to3 generated .bak files.
* Not really needed with a real VCS, but couldn't hurt to have them for
a couple of revisions. ;)
@ -548,7 +548,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Fri May 1 21:45:50 2015 +1000
2to3 conversion log
* The output of the command to convert the code from Python 2 to 3.
* Note: this contains the list of files which were not modified and
which will or may need to be modified.
@ -561,7 +561,7 @@ Author: Ben McGinnes <ben@adversary.org>
Date: Fri May 1 21:36:58 2015 +1000
2to3 conversion of pyme master
* Branch from commit 459f3eca659b4949e394c4a032d9ce2053e6c721
* Ran this: or x in `find . | egrep .py$` ; do 2to3 -w $x; done ;
* Multiple files not modified, will record elsewhere (see next commit).
@ -614,7 +614,7 @@ Author: Martin Albrecht <martinralbrecht@googlemail.com>
Date: Wed Jul 9 10:48:33 2014 +0100
Merged in jerrykan/pyme/fix_setup_26 (pull request #1)
Provide support for using setup.py with Python v2.6
commit dae7f14a54e6c2bde0ad4da7308cc7fc0d0c0469
@ -622,7 +622,7 @@ Author: John Kristensen <john.kristensen@dpipwe.tas.gov.au>
Date: Wed Jul 9 15:54:39 2014 +1000
Provide support for using setup.py with Python v2.6
The setup.py script uses subprocess.check_output() which was introduced
in Python v2.7. The equivalent functionality can be achieved without
adding much extra code and provide support for Python v2.6.
@ -701,7 +701,7 @@ Author: Martin Albrecht <martinralbrecht@googlemail.com>
Date: Sat May 10 15:41:02 2014 +0100
Merge branch 'master' of bitbucket.org:malb/pyme
Conflicts:
setup.py
@ -1018,10 +1018,10 @@ Author: Martin Albrecht <martinralbrecht@googlemail.com>
Date: Mon Jan 6 17:44:20 2014 +0100
fixing op_export_keys()
the conversion of gpgme_key_t [] was restricted to gpgme_key_t [] with the
name recv, i.e. only the use-cases of encryption were covered.
see: http://sourceforge.net/mailarchive/forum.php?forum_name=pyme-help&max_rows=25&style=nested&viewmonth=201309
pyme/gpgme.i | 6 +++---
@ -1618,9 +1618,9 @@ Date: Fri Jun 10 03:01:22 2005 +0000
Update 'docs' rule in Makefile to build packages first to ensure that
documentation is build for the current version of pyme and not for the
installed one.
Added 'callbacks' into the list of visible pyme modules (__all__ var.)
Slightly updated INSTALL file.
pyme/INSTALL | 11 ++++++++---
@ -2100,7 +2100,7 @@ Author: belyi <devnull@localhost>
Date: Fri Mar 18 19:09:33 2005 +0000
Added package building for python2.4
Updated copyright notes to include myslef and avoid confusion who's the
maintainer. In John's own words: "I'd prefer to just step out of the picture".
Jonh's copyright notice left intact.

View File

@ -54,7 +54,7 @@ for key in c.op_keylist_all(None, 0):
(keyid, can_encrypt and "enabled" or "disabled"))
except UnicodeEncodeError as e:
print(e)
if valid:
names.append(key)
else:

View File

@ -43,7 +43,7 @@ if not c.signers_enum(0):
passlist = {
b"<joe@example.org>": b"Crypt0R0cks"
}
# callback will return password based on the e-mail listed in the hint.
c.set_passphrase_cb(lambda x,y,z: passlist[x[x.rindex("<"):]])

View File

@ -32,7 +32,7 @@ class KeyEditor:
out.seek(0,0)
print(out.read(), end=' ')
print("[-- Code: %d, %s --]" % (status, args))
if args == "keyedit.prompt":
result = self.steps[self.step]
self.step += 1

View File

@ -22,7 +22,7 @@ from pyme.constants import protocol
def printgetkeyresults(keyfpr):
"""Run gpgme_get_key()."""
# gpgme_check_version() necessary for initialisation according to
# gpgme_check_version() necessary for initialisation according to
# gogme 1.1.6 and this is not done automatically in pyme-0.7.0
print("gpgme version:", core.check_version(None))
c = core.Context()
@ -45,5 +45,3 @@ def main():
if __name__ == "__main__":
main()

View File

@ -96,5 +96,3 @@ def main():
if __name__ == "__main__":
main()

View File

@ -241,14 +241,14 @@ gpgme_error_t pyEditCb(void *opaque, gpgme_status_code_t status,
func = pyopaque;
pyargs = PyTuple_New(2);
}
PyTuple_SetItem(pyargs, 0, PyLong_FromLong((long) status));
PyTuple_SetItem(pyargs, 1, PyBytes_FromString(args));
if (dataarg) {
Py_INCREF(dataarg); /* Because GetItem doesn't give a ref but SetItem taketh away */
PyTuple_SetItem(pyargs, 2, dataarg);
}
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {

View File

@ -66,7 +66,7 @@ static gpgme_error_t pyPassphraseCb(void *hook,
PyObject *args = NULL;
PyObject *retval = NULL;
PyObject *dataarg = NULL;
gpgme_error_t err_status = 0;
gpgme_error_t err_status = 0;
pygpgme_exception_init();
@ -119,7 +119,7 @@ static void pyProgressCb(void *hook, const char *what, int type, int current,
int total) {
PyObject *func = NULL, *dataarg = NULL, *args = NULL, *retval = NULL;
PyObject *pyhook = (PyObject *) hook;
if (PyTuple_Check(pyhook)) {
func = PyTuple_GetItem(pyhook, 0);
dataarg = PyTuple_GetItem(pyhook, 1);
@ -137,7 +137,7 @@ static void pyProgressCb(void *hook, const char *what, int type, int current,
Py_INCREF(dataarg); /* Because GetItem doesn't give a ref but SetItem taketh away */
PyTuple_SetItem(args, 4, dataarg);
}
retval = PyObject_CallObject(func, args);
Py_DECREF(args);
Py_XDECREF(retval);

View File

@ -33,7 +33,7 @@ def passphrase_stdin(hint, desc, prev_bad, hook=None):
def progress_stdout(what, type, current, total, hook=None):
print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" %\
(what, type, current, total))
def readcb_fh(count, hook):
"""A callback for data. hook should be a Python file-like object."""
if count:

View File

@ -37,7 +37,7 @@ class Context(GpgmeWrapper):
def _getctype(self):
return 'gpgme_ctx_t'
def _getnameprepend(self):
return 'gpgme_'
@ -106,7 +106,7 @@ class Context(GpgmeWrapper):
if key:
key.__del__ = lambda self: pygpgme.gpgme_key_unref(self)
return key
def get_key(self, fpr, secret):
"""Return the key corresponding to the fingerprint 'fpr'"""
ptr = pygpgme.new_gpgme_key_t_p()
@ -147,7 +147,7 @@ class Context(GpgmeWrapper):
desc, a string describing the passphrase it needs;
prev_bad, a boolean equal True if this is a call made after
unsuccessful previous attempt.
If hook has a value other than None it will be passed into the func
as a forth argument.
@ -206,7 +206,7 @@ class Context(GpgmeWrapper):
context = pygpgme.gpgme_wait(self.wrapped, ptr, hang)
status = pygpgme.gpgme_error_t_p_value(ptr)
pygpgme.delete_gpgme_error_t_p(ptr)
if context == None:
errorcheck(status)
return None
@ -219,7 +219,7 @@ class Context(GpgmeWrapper):
raise ValueError("op_edit: First argument cannot be None")
opaquedata = (func, fnc_value)
errorcheck(pygpgme.gpgme_op_edit(self.wrapped, key, opaquedata, out))
class Data(GpgmeWrapper):
"""From the GPGME C manual:
@ -236,7 +236,7 @@ class Data(GpgmeWrapper):
def _getctype(self):
return 'gpgme_data_t'
def _getnameprepend(self):
return 'gpgme_data_'
@ -247,7 +247,7 @@ class Data(GpgmeWrapper):
name == 'gpgme_data_seek':
return 0
return 1
def __init__(self, string = None, file = None, offset = None,
length = None, cbs = None):
"""Initialize a new gpgme_data_t object.
@ -360,7 +360,7 @@ class Data(GpgmeWrapper):
"""This wraps the GPGME gpgme_data_new_from_fd() function.
The argument "file" may be a file-like object, supporting the fileno()
call and the mode attribute."""
tmp = pygpgme.new_gpgme_data_t_p()
fp = pygpgme.fdopen(file.fileno(), file.mode)
if fp == None:
@ -375,18 +375,18 @@ class Data(GpgmeWrapper):
new_from_fd() method since in python there's not difference
between file stream and file descriptor"""
self.new_from_fd(file)
def write(self, buffer):
errorcheck(pygpgme.gpgme_data_write(self.wrapped, buffer, len(buffer)))
def read(self, size = -1):
"""Read at most size bytes, returned as a string.
If the size argument is negative or omitted, read until EOF is reached.
Returns the data read, or the empty string if there was no data
to read before EOF was reached."""
if size == 0:
return ''
@ -445,11 +445,11 @@ def set_locale(category, value):
def wait(hang):
"""Wait for asynchronous call on any Context to finish.
Wait forever if hang is True.
For finished anynch calls it returns a tuple (status, context):
status - status return by asnynchronous call.
context - context which caused this call to return.
Please read the GPGME manual of more information."""
ptr = pygpgme.new_gpgme_error_t_p()
context = pygpgme.gpgme_wait(None, ptr, hang)

View File

@ -22,7 +22,7 @@ class GPGMEError(Exception):
def __init__(self, error = None, message = None):
self.error = error
self.message = message
def getstring(self):
message = "%s: %s" % (pygpgme.gpgme_strsource(self.error),
pygpgme.gpgme_strerror(self.error))
@ -35,7 +35,7 @@ class GPGMEError(Exception):
def getsource(self):
return pygpgme.gpgme_err_source(self.error)
def __str__(self):
return "%s (%d,%d)"%(self.getstring(), self.getsource(), self.getcode())

View File

@ -28,7 +28,7 @@ def process_constants(starttext, dict):
continue
name = identifier[index:]
dict[name] = getattr(pygpgme, identifier)
class GpgmeWrapper(object):
"""Base class all Pyme wrappers for GPGME functionality. Not to be
instantiated directly."""
@ -51,7 +51,7 @@ class GpgmeWrapper(object):
def _getctype(self):
raise NotImplementedException
def __getattr__(self, name):
"""On-the-fly function generation."""
if name[0] == '_' or self._getnameprepend() == None:

View File

@ -60,7 +60,7 @@ for item in getconfig('cflags'):
# Adjust include and library locations in case of win32
uname_s = os.popen("uname -s").read()
if uname_s.startswith("MINGW32"):
mnts = [x.split()[0:3:2] for x in os.popen("mount").read().split("\n") if x]
mnts = [x.split()[0:3:2] for x in os.popen("mount").read().split("\n") if x]
tmplist = sorted([(len(x[1]), x[1], x[0]) for x in mnts])
tmplist.reverse()
extra_dirs = []
@ -89,9 +89,9 @@ except OSError as e:
raise RuntimeError("Could not call swig, perhaps install swig.")
else:
raise
subprocess.call(["make swig"], shell=True)
swige = Extension("pyme._pygpgme", ["gpgme_wrap.c", "helpers.c"],
include_dirs = include_dirs,
define_macros = define_macros,
@ -106,7 +106,7 @@ setup(name = "pyme",
url = version.homepage,
ext_modules=[swige],
packages = ['pyme', 'pyme.constants', 'pyme.constants.data',
'pyme.constants.keylist', 'pyme.constants.sig'],
'pyme.constants.keylist', 'pyme.constants.sig'],
license = version.copyright + \
", Licensed under the GPL version 2 and the LGPL version 2.1"
)