Check for Py2.6 in setup.py; then add ordereddict to install_requires.

fix/30-hidden-recipient
Isis Lovecruft 2013-12-04 00:31:41 +00:00
parent 27cab9651e
commit cc59df2ca3
No known key found for this signature in database
GPG Key ID: 5C17776E27F7E84D
2 changed files with 14 additions and 6 deletions

View File

@ -25,12 +25,9 @@ from __future__ import absolute_import
from __future__ import print_function
try:
# py2.7+ comes with collections.OrderedDict
from collections import OrderedDict
import collections
except ImportError:
# py2.6 doesn't; this is an equivalent;
# `pip install ordereddict`
from ordereddict import OrderedDict
import ordereddict as collections
import re
@ -1029,7 +1026,7 @@ class ImportResult(object):
_fields = '''count no_user_id imported imported_rsa unchanged
n_uids n_subk n_sigs n_revoc sec_read sec_imported sec_dups
not_imported'''.split()
_counts = OrderedDict(
_counts = collections.OrderedDict(
zip(_fields, [int(0) for x in range(len(_fields))]) )
#: A list of strings containing the fingerprints of the GnuPG keyIDs

View File

@ -23,6 +23,7 @@ from __future__ import absolute_import
from __future__ import print_function
import setuptools
import sys
import os
import versioneer
@ -37,6 +38,12 @@ __contact__ = 'isis@patternsinthevoid.net'
__url__ = 'https://github.com/isislovecruft/python-gnupg'
def python26():
"""Returns True if we're running on Python2.6."""
if sys.version[:3] == "2.6":
return True
return False
def get_requirements():
"""Extract the list of requirements from our requirements.txt.
@ -64,6 +71,10 @@ def get_requirements():
except (IOError, OSError) as error:
print(error)
if python26():
# Required to make `collections.OrderedDict` available on Python<=2.6
requirements.append('ordereddict==1.1#a0ed854ee442051b249bfad0f638bbec')
return requirements, links