Commit Graph

24 Commits (de82a1c32adca7534d7784518fe4983eb33d29ef)

Author SHA1 Message Date
Isis Lovecruft 1104908ef9
Don't expect a $HOME directory to be set.
* FIXES Issue #74:
   https://github.com/isislovecruft/python-gnupg/issues/74
2014-11-19 18:31:14 +00:00
Isis Lovecruft eb25ef2b91
Only compile the version string regex once on module import.
* MOVE the compiled regex for matching the GnuPG binary's version to a
   module-level variable in `gnupg._util`.
2014-09-26 02:24:46 +00:00
Les Aker ff96904233 Merge branch 'master' of github.com:isislovecruft/python-gnupg 2014-06-14 19:39:07 -04:00
Matt Behrens 3be2697a1b WIP fixing serveral Python 3 tests for #16 2014-03-30 19:53:45 -04:00
Matt Behrens 929fad0a1a prune unused exceptions imports for Python 3 2014-03-26 22:33:03 -04:00
Isis Lovecruft f5b345b1ae
Refactor _util._is_file to handle detached sigs and data on stdin.
When gnupg.GPG.verify_file() was changed recently to take the filename
of the signature file as an argument to GnuPG, and then take the data
file to be verified on stdin, the parser in _parsers._check_options()
would call _util._is_file(), which would return False and log an error
that "'-' is not a file!". This fixes that issue by catching OSError and
treating it differently.

Additionally, I renamed the _util._is_file() parameter
`input`→`filename` to avoid overriding a builtin method.

I also replaced the `assert` lines with explicit checks, because
`assert`s are stripped out when the Python interpreter is run with -OO.

 * FIXES an issue with verification of detached signatures whose
   datafiles are read from stdin.
2013-12-04 10:02:08 +00:00
Isis Lovecruft 04b9a13a51
Cleanup docstrings in _util.py. 2013-12-03 22:27:11 +00:00
Isis Lovecruft f38caae84d
Remove duplicate headings from module docstrings. 2013-12-03 22:21:36 +00:00
Isis Lovecruft b1bc36e718
Merge remote-tracking branch 'drebs/bug/fix-os.getresuid-not-supported-on-os-x' into develop 2013-12-02 23:30:02 +00:00
Isis Lovecruft 33c905ed0f
Fix whitespace indentation levels in _util.InheritableProperty class. 2013-12-02 08:44:31 +00:00
Les Aker 4dccc94d24 If given an absolute path, use it 2013-11-21 21:02:35 -05:00
drebs 2c0c826c0f Fix gpg binary path validation. 2013-10-24 18:04:30 -02:00
drebs e6944488fb Replace os.getresuid() so it works on Mac OS X. 2013-10-14 14:35:01 -03:00
Isis Lovecruft 4955fed865
Separate gnupg.GPGBase._read_response() into multiple functions.
* ADD function _util._deprefix() for stripping a given prefix from the
   beginning of another string.
 * ADD function _util._separate_keywork() for extracting the keyword from the
   beginning of status-fd output.
 * REMOVE excess EOL whitespace.
 * CLEANUP method gnupg.GPGBase._read_response().
2013-10-08 09:58:27 +00:00
Isis Lovecruft 47c891814f
Change function gnupg._util._find_binary() to also find gpg2.
* CHANGE _find_binary() utility function to look for a gpg2 binary on the
   users PATH if no binary is given and gpg is not found.
 * FIXES an error where only gpg=>1.4.x was found.
2013-10-08 08:53:54 +00:00
Isis Lovecruft 6eccbe7048
Make default gen_key_input() Key-Type conditional on GnuPG version.
* ADD functions _util._match_version_string(), _util._is_gpg2(), and
   _util._is_gpg1() for determining whether to set the default Key-Type to
   'default' (for GnuPG v2.x) or to 'RSA' (for GnuPG v1.x).
 * ADD class attribute GPG.binary_version, which stores the GnuPG executable's
   version string, which should be in the form x.x.x, where 'x' is an integer.
2013-07-28 11:28:49 +00:00
Isis Lovecruft 6b154c294e
Change LICENSE to GPLv3+, after discussion with intrigeri.
* ADD docs/change-license-emails.txt, which includes email exchanges between
   myself and intrigeri, including links to Debian and LEAP mailing lists with
   arguments for and against using AGPL for a library.
 * CHANGE license header for all files.
 * CHANGE LICENSE file and gnupg/copyright.py to use GPLv3+ text.
2013-07-27 19:27:53 +00:00
Isis Lovecruft 8bad2f3c05
Merge remote-tracking branch 'mmn/mktime_takes_localtime_not_gmtime' into develop
* FIX struct_time inputs to time.mktime() to use localtime() not gmtime().
 * CLOSES #9: "mktime takes local time, not UTC"
   https://github.com/isislovecruft/python-gnupg/pull/9
2013-07-26 14:32:43 +00:00
Mikael Nordfeldth 9ff03b5be7 mktime takes localtime, or we skew the clocks
The following snippet shows that to create a proper timestamp, we should
feed mktime() with localtime() data rather than gmtime(), as it is locale
aware.

>>> from time import mktime, gmtime, localtime
>>> bad    = gmtime(mktime(gmtime()))
>>> good   = gmtime(mktime(localtime()))
>>> judge  = gmtime()
>>> if bad == good: "You're using UTC. Demonstration is impossible."
... elif bad == judge: "I can be wrong"
... elif good == judge: "but this shows I'm right"
...
"but this shows I'm right"

The above code checks whether gmtime() == gmtime(timestamp) from
mktime(). Obviously we don't get the same 'now' if we feed the bad value
to mktime.
2013-07-26 01:02:46 +02:00
Mikael Nordfeldth a3e811a919 Python 3 fixes for chmod and exceptions 2013-07-24 15:04:15 +02:00
Isis Lovecruft 603379eb37
Change _copy_data() error handling to explain errors not due to broken pipes. 2013-06-28 06:40:09 +00:00
Isis Lovecruft e1139c7e37
Remove commented out code from _util._copy_data(). 2013-06-09 08:36:22 +00:00
Isis Lovecruft ceb38fdefe
Change directory shortcuts in gnupg._util.py module. 2013-06-09 08:33:30 +00:00
Isis Lovecruft 042d52a75f
Move source files to directory named for top-level package. 2013-06-03 21:16:19 +00:00