Isis Lovecruft
1d326f8808
GnuPG only *sometimes* returns the filename for the plaintext.
...
* We can't split twice at first, because sometimes there isn't a third field
in the string.
* There isn't any rhyme or reason to when the filename is present or
missing. It just is.
2013-05-27 07:46:54 +00:00
Isis Lovecruft
1c3f0c3c9a
There are lots of these list(dict.items()) in the old codebase. Total nonsense.
...
* These evaluate in all interpreters to functionally the same bytecode, with
an extra LOAD_GLOBAL and then a CALL_FUNCTION for that GLOBAL which doesn't
gets a passthrough value. I have absolutely no idea why someone thought it
was necessary to code it this way, unless there used to be some weird dict
bug in some version of Python (which is totally possible) that I don't
remember and have never heard about. Disassembled:
>>> def normal(things):
... for k,v in things.items():
... print "%s=%s" % (k,v)
...
...
>>> def notnormal(things):
... for k,v in list(things.items()):
... print "%s=%s" % (k,v)
...
>>> dis.dis(normal)
2 0 SETUP_LOOP 41 (to 44)
3 LOAD_FAST 0 (things)
6 LOAD_ATTR 0 (items)
9 CALL_FUNCTION 0
12 GET_ITER
>> 13 FOR_ITER 27 (to 43)
16 UNPACK_SEQUENCE 2
19 STORE_FAST 1 (k)
22 STORE_FAST 2 (v)
3 25 LOAD_CONST 1 ('%s=%s')
28 LOAD_FAST 1 (k)
31 LOAD_FAST 2 (v)
34 BUILD_TUPLE 2
37 BINARY_MODULO
38 PRINT_ITEM
39 PRINT_NEWLINE
40 JUMP_ABSOLUTE 13
>> 43 POP_BLOCK
>> 44 LOAD_CONST 0 (None)
47 RETURN_VALUE
>>> dis.dis(notnormal)
2 0 SETUP_LOOP 47 (to 50)
3 LOAD_GLOBAL 0 (list)
6 LOAD_FAST 0 (things)
9 LOAD_ATTR 1 (items)
12 CALL_FUNCTION 0
15 CALL_FUNCTION 1
18 GET_ITER
>> 19 FOR_ITER 27 (to 49)
22 UNPACK_SEQUENCE 2
25 STORE_FAST 1 (k)
28 STORE_FAST 2 (v)
3 31 LOAD_CONST 1 ('%s=%s')
34 LOAD_FAST 1 (k)
37 LOAD_FAST 2 (v)
40 BUILD_TUPLE 2
43 BINARY_MODULO
44 PRINT_ITEM
45 PRINT_NEWLINE
46 JUMP_ABSOLUTE 19
>> 49 POP_BLOCK
>> 50 LOAD_CONST 0 (None)
53 RETURN_VALUE
2013-05-27 07:28:03 +00:00
Isis Lovecruft
c31e1303ba
GnuPG status code '17' on imports means '16'. That wasn't documented anywhere.
2013-05-27 07:26:15 +00:00
Isis Lovecruft
c3dcd34f5a
This log statement didn't need 2LOC.
2013-05-27 07:25:27 +00:00
Isis Lovecruft
e52e9001d1
Rewrite _check_option() in _sanitise() to be way more efficient and readable.
2013-05-27 07:24:31 +00:00
Isis Lovecruft
f65022500d
Add note on using itertools.dropwhile() for efficiency in _is_allowed().
...
* If/when it's rewritten, a simple speed/efficiency check can be done with:
>>> import dis
>>> dis.dis(_is_allowed_orig('--dragons'))
>>> dis.dis(_is_allowed_orig('--encrypt'))
>>> dis.dis(_is_allowed_new('--dragons'))
>>> dis.dis(_is_allowed_new('--encrypt'))
2013-05-27 07:19:40 +00:00
Isis Lovecruft
69c6981b66
A unicode(list()) versus a unicode(str()) are different.
2013-05-27 07:15:33 +00:00
Isis Lovecruft
30223d4203
Don't attempt to set up logging to file unless logging is actually enabled.
2013-05-27 07:14:03 +00:00
Isis Lovecruft
7700b012b1
Only gnupg.__version__, not gnupg._version, should be accessible in module.
2013-05-27 07:12:50 +00:00
Isis Lovecruft
ae1042d56f
Add notes to requirements.txt on dependencies, and remove setuptools-git.
2013-05-26 17:34:22 +00:00
Isis Lovecruft
c683ef31c2
Move old documentation to Sphinx rest file at the end.
...
* It seems annoying to have a bunch of licensing and history lessons as the
first thing you read when you look at the documentation. Rather, the first
thing you see should be how to install it and use it.
2013-05-26 14:04:33 +00:00
Isis Lovecruft
dfbba04bd7
Add note to TODO file about python ORMs for public key storage.
2013-05-25 23:04:45 +00:00
Isis Lovecruft
780360ea9f
Add missing test keyring file.
2013-05-24 19:32:33 +00:00
Isis Lovecruft
a34084c332
Use py3k syntax for relative imports in test/test_gnupg.py.
2013-05-24 07:24:04 +00:00
Isis Lovecruft
4c67e45759
Add batch file save functionality, including creating a README in that dir.
2013-05-23 08:56:20 +00:00
Isis Lovecruft
0921ca7a2b
If Key-Type is 'default', force 'Subkey-Type' to also be 'default'.
2013-05-23 08:54:05 +00:00
Isis Lovecruft
9e5bdafffa
Remove excess EOL whitespace.
2013-05-23 08:52:18 +00:00
Isis Lovecruft
22aa8d2ee1
Add a parameter to GPG.gen_key_input for saving batch files.
2013-05-23 08:49:27 +00:00
Isis Lovecruft
51e2b33265
Add .../homedir/batch-files and .../homedir/generated-keys directories.
2013-05-23 08:47:47 +00:00
Isis Lovecruft
8afd189d36
InheritablePropery→_util.InheritableProperty
2013-05-23 07:06:11 +00:00
Isis Lovecruft
c7a4845ce4
Also get set GPG.filesystemencoding in case we have to save a file.
2013-05-23 07:05:14 +00:00
Isis Lovecruft
de9eb4ca77
Add utility for getting the timestamp in ISO 8601 format.
2013-05-23 07:03:55 +00:00
Isis Lovecruft
55ca5487bb
Change sign/sign_with param in GPG.encrypt* to be named 'default_key'.
2013-05-23 05:15:22 +00:00
Isis Lovecruft
b50e91bd5e
Remove two extra functions from GPGWrapper class.
2013-05-22 17:58:22 +00:00
Isis Lovecruft
9aa7ad8c69
Add class attrs and docs to Verify, add new _parsers.Crypt class.
2013-05-22 17:38:35 +00:00
Isis Lovecruft
bac7e52fc0
Update docs for _parsers.Verify.
2013-05-22 17:37:37 +00:00
Isis Lovecruft
596d6cd2d3
Parse NODATA status code in _parsers.Sign.
2013-05-22 17:37:05 +00:00
Isis Lovecruft
75f3a4a89e
_handle_status→handle_status
2013-05-22 17:36:28 +00:00
Isis Lovecruft
18ffc52aca
Add better parsing of PROGRESS and NODATA status codes in _parsers.GenKey.
2013-05-22 17:34:46 +00:00
Isis Lovecruft
88352ef95c
Remove extra Verify and Crypt from _parsers.
2013-05-22 17:29:06 +00:00
Isis Lovecruft
10014d5401
Rewrite multi-recipient encryption test
2013-05-22 17:25:57 +00:00
Isis Lovecruft
345ca75e85
Minor fixes to encryption with iso-8859-1 encodings test.
2013-05-22 17:25:21 +00:00
Isis Lovecruft
ba37ce083d
Explicitly set the passphrase on one of the unittest keys.
2013-05-22 17:23:18 +00:00
Isis Lovecruft
3780a6bed2
More whitespace/style fixes.
2013-05-22 17:22:30 +00:00
Isis Lovecruft
fba19da0a0
Use the setting in GPGTestCase.__init__() for insecure PRNG.
2013-05-22 17:20:55 +00:00
Isis Lovecruft
8cdc85aa0e
Add some point the order of these two args was switch, so test should match.
2013-05-22 17:18:58 +00:00
Isis Lovecruft
e563faa344
Add print() in unittest for the binary location to be sure PATH hack works.
2013-05-22 17:17:02 +00:00
Isis Lovecruft
c577fdcfe5
Add unittests for codec translator utilities.
2013-05-22 17:12:27 +00:00
Isis Lovecruft
5578f130b8
Update docs for GPG.gen_key_input().
2013-05-22 17:09:02 +00:00
Isis Lovecruft
b6797d6a47
Replace old doctest in GPG.gen_key_input().
2013-05-22 17:06:48 +00:00
Isis Lovecruft
352668b7af
Use codecs.open() in gnupg.py.
2013-05-22 17:05:46 +00:00
Isis Lovecruft
9437604c71
Add list-sigs implementation
2013-05-22 17:05:17 +00:00
Isis Lovecruft
60d6f676e5
util→_util & parsers→_parsers
2013-05-22 17:01:36 +00:00
Isis Lovecruft
18f0e97134
Remove extra whitespace
2013-05-22 16:58:47 +00:00
Isis Lovecruft
e6538d6ca3
Change keyring/secring attrs to be based on settings in tests
2013-05-22 16:57:41 +00:00
Isis Lovecruft
2d19b7d771
Add a way to save generated test keys for later debugging
2013-05-22 16:54:56 +00:00
Isis Lovecruft
9b6f823a6e
Whitespace fixes
2013-05-22 16:53:18 +00:00
Isis Lovecruft
a3ac1efb94
Use the log object from _util in test handler.
2013-05-22 16:52:35 +00:00
Isis Lovecruft
c36687f45a
util→_util & parsers→_parsers
2013-05-22 16:51:33 +00:00
Isis Lovecruft
ac8ef6c721
Add codecs and encodings to test handler so that open() uses them
2013-05-22 16:49:40 +00:00