Commit Graph

550 Commits (b7d9f749b69a5cbe1c497e7fae516e63f4326c9c)

Author SHA1 Message Date
Isis Lovecruft 931713eca3
Add TODO file with ideas for future improvements. 2013-05-18 15:27:20 +00:00
Isis Lovecruft 5cd2e19361
Minor and unnecessary obsessive compulsive code formatting change. 2013-05-18 15:12:00 +00:00
Isis Lovecruft a3d2616a6c
Add a a log formatter and a new log level for GnuPG internal status codes. 2013-05-18 15:08:54 +00:00
Isis Lovecruft 848e410f19
Add MetaGPG and GPGBase for handling attribute/property setup.
* These classes also play a few other tricks, like the steps taken to disable
   pinentry if GPG.use_agent=False:

       1) detect if gpg-agent is running for the same EUID as python,
          and if it is then
       2) find out if the user wants us to use it, and if they don't then
       3) find if pinentry is installed, and if it is then
       4) modify the system PATH to exclude the directory where pinentry is,
          symlinking out gpg if gpg was in the same directory, and then
       5) register an _exithandler with the interpreter to replace the
          original environment when the interpreter exits.
2013-05-18 15:07:49 +00:00
Isis Lovecruft a4630e1cfb
Add InheritablePropery class for mutable, inheritable descriptors.
* This allows us to define immutable x.getter and x.setter methods in a
   parent class while still inheriting the ability to alter the descriptor in
   a child class without needing to set something like:
       @property
       def x(self):
           super(self.__class__, self)._get_x()
   as a property override for every descriptor.
2013-05-18 14:49:09 +00:00
Isis Lovecruft 4ea1884239
Update .gitigore to exclude symlinked gpg binaries. 2013-05-18 14:46:41 +00:00
Isis Lovecruft de8dd5ac1e
Update imports in gnupg.py with parsers->_parsers and util->_util. 2013-05-18 04:48:03 +00:00
Isis Lovecruft 4857a475bc
Update import statements in _parsers.py with util->_util. 2013-05-18 04:39:31 +00:00
Isis Lovecruft 1dab5c681e
Credit drebs in _parsers.py too. 2013-05-18 04:38:57 +00:00
Isis Lovecruft c0b599ee06
Remove interpreter directive from _parsers.py. 2013-05-18 04:38:30 +00:00
Isis Lovecruft 6874f7b838
Add docstring for _util._write_passphrase() function. 2013-05-18 04:37:30 +00:00
Isis Lovecruft f1a6526b5c
Update log statements in _util.py. 2013-05-18 04:37:02 +00:00
Isis Lovecruft 4ffe368230
Update directory shortcuts in utils to reflect path changes. 2013-05-18 04:35:45 +00:00
Isis Lovecruft d3b190f4f2
Test that clients' Python handles the basestring builtin correctly. 2013-05-18 04:34:26 +00:00
Isis Lovecruft a13ca55796
Remove old log setup code, use result of _logger.create_logger(). 2013-05-18 04:33:47 +00:00
Isis Lovecruft 904154029d
Rename util.py to _util.py. 2013-05-18 04:30:36 +00:00
Isis Lovecruft 36511c4727
Rename parsers.py to _parsers.py. 2013-05-18 04:29:16 +00:00
Isis Lovecruft 9bd451d7da
Fix encoding strings and remove script directive. 2013-05-17 12:42:29 +00:00
Isis Lovecruft f4e2ed69dc
Import _ansiterm without using module namespace. 2013-05-17 12:40:42 +00:00
Isis Lovecruft 7a9e8a55bd
Remove unused ctypes import. 2013-05-17 12:40:09 +00:00
Isis Lovecruft c1bd8bdbab
Remove unnecessary module.__name__. 2013-05-17 12:38:59 +00:00
Isis Lovecruft 88b9fad430
Fix encoding string. 2013-05-17 12:38:36 +00:00
Isis Lovecruft 89e9e9baac
Update util._create_if_necessary() docstring. 2013-05-17 02:46:33 +00:00
Isis Lovecruft c6880b5779
Rename util._create_homedir() to more general util._create_if_necessary(). 2013-05-17 02:45:03 +00:00
Isis Lovecruft 2abcf8a733
Fix $PWD discovery to reflect the prior change to use src/ instead of gnupg/. 2013-05-17 02:41:39 +00:00
Isis Lovecruft 9f18699285
Fix module docstring typo in src/util.py. 2013-05-17 02:40:49 +00:00
Isis Lovecruft f5f67cef4c
Remove script headers from src/util.py. 2013-05-17 02:40:20 +00:00
Isis Lovecruft fa2db06a3c
Add "del gnupg" in src/__init__.py to get rid of gnupg.gnupg in API. 2013-05-17 02:39:08 +00:00
Isis Lovecruft 81312015ab
Remove everything except the GPG class from src/__init__.py. 2013-05-17 02:38:25 +00:00
Isis Lovecruft 891ee9e7eb
Significantly improve logging facilities for faster debugging.
* Include _ansistrm.py, which was released under new BSD license separately in
   a github gist as well as in the Python logutils module. Instead of setting
   up a src/includes/ directory, I have included this file in the currently
   flat module directory, because dealing with submodule imports in Python2.x
   is a pain. I'm not sure if this will cause problems for Debian packaging,
   but it could be changed later if so. The full text of the original license
   and copyright has been retained at the head of _ansistrm.py, clearly
   demarcated from python-gnupg's license and copyright info. The author of
   _ansistrm.py is the same as the current upstream maintainer for
   python-gnupg, Vinay Sajip, and I don't see why this person doesn't include
   _ansistrm.py in all of their packages, because it is making skimming the
   test logs for errors much faster.

 * Add _logger.py, which contains a class decorator:

       @wraps(logging.Logger)
       def create_logger(level=logging.NOTSET)
       [...]

   which autoconfigures logging functionality. By default, logging.NullHandler
   is still used, so there are no logs (neither logfiles nor piped to
   stdout). If _logger.create_logger() is called with either a LEVEL attribute
   from the logging module, or the integer equivalent, it will initialise
   logging to stdout only. In the unittest suite, extra log handling
   functionality is added to also write to a datetime-stamped logfile in the
   tests/ directory.

 * Change all "logger.<level>" statements to "log.<level>" and add new ones for
   debugging and user information purposes.

 * Remove the import of the python standard utilities logging module from:
       src/gnupg.py
       src/parsers.py
       src/util.py

   and switch to setting a top-level attribute, util.log, which is the returned
   class from _logger.create_logger(). Everything else now does "from util
   import log".
2013-05-17 02:15:17 +00:00
Isis Lovecruft 3038e3948b
Remove relative imports of every class in parsers.py, they crowd the namespace. 2013-05-17 01:13:02 +00:00
Isis Lovecruft 5fe8320fd0
We don't need module strings with a flat directory structure. 2013-05-17 01:08:07 +00:00
Isis Lovecruft 2686131809
Reorder frozenset of allowed options so that it's easier to read. 2013-05-17 01:04:45 +00:00
Isis Lovecruft b84268fecd
Locally scoped ivars in _check_preferences don't need private namespace. 2013-05-17 01:02:27 +00:00
Isis Lovecruft 615e2cfa60
Add docstring for parsers._check_preferences. 2013-05-17 01:00:05 +00:00
Isis Lovecruft 81514e0ec4
Fix parsers._check_preferences function to use set theoretic intersection.
* It benchmarks super fast. And I get to use set theory.
2013-05-17 00:58:43 +00:00
Isis Lovecruft 41d9ab27bd
Don't point users to github, where possible.
* Github has these rather nasty tracking mechanisms through pixel cookies, as
   well as hardware fingerprinting (potentially deanonymising) through HTML5
   canvases.
 * I suck at configuring gitweb + lighttpd. I cannot get pretty URLs for the
   repos, but it's still better than the pixel cookies. If anyone can point me
   at something for fixing this, much obliged. I wasn't sure if I should point
   explicitly to a LEAP server.
2013-05-17 00:54:48 +00:00
Isis Lovecruft 26da5c3e73
Remove copyright info from top level of module.
* Previously, it was:
       In [1]: import gnupg
       In [2]: gnupg.
       gnupg.GPG       gnupg.copyright  gnupg.logger    gnupg.util
       gnupg.copyleft  gnupg.gnupg      gnupg.parsers
   So I've started cleaning up the API so the only thing visible on module import
   is the class you probably need: gnupg.GPG .
2013-05-17 00:45:59 +00:00
Isis Lovecruft a9154b25d5
Add .gitattributes file for versioneer. 2013-05-13 10:16:39 +00:00
Isis Lovecruft 1588822f02
Fix accidental misnaming from sed 's/pubring/keyring/'. 2013-05-13 09:14:42 +00:00
Isis Lovecruft e462cf42ed
Call parsers._check_preferences() to set default_preference_list. 2013-05-13 02:39:19 +00:00
Isis Lovecruft c5a7ccb572
Update module level docstring. 2013-05-13 00:46:58 +00:00
Isis Lovecruft 0fa269c93c
Fix the directory shortcuts in utils.py according to the new module layout. 2013-05-13 00:44:29 +00:00
Isis Lovecruft c305f8c5c3
Add tests to Makefile cmds, and add better test cleanup. 2013-05-12 10:22:44 +00:00
Isis Lovecruft c97b51fec5
Add versioneer and restructure the repo into a src/ dir. 2013-05-12 09:32:46 +00:00
Isis Lovecruft 25637ef50e
PEP-8ify a couple lines that were running off the screen.
* Also, change a logger string to say 'GnuPG' instead of the binary's name
   'gpg'.
2013-05-11 18:34:28 +00:00
Isis Lovecruft e3eb7eea0c
Fix an old-style class. 2013-05-11 18:33:39 +00:00
Isis Lovecruft 2700b3c338
Return the result of a encryption or decryption operation without *.data 2013-05-11 18:32:18 +00:00
Isis Lovecruft e5ac938486
Add hastily written check_preferences().
* TODO I sleepily realised two lines before the end of bashing this out that
   it should just be a set difference.
2013-05-11 18:30:22 +00:00
Isis Lovecruft 4258900368
Fix a bug which caused result_map['crypt'] to expect a Verify(). 2013-05-11 18:28:47 +00:00