Check for Py2.6 in setup.py; then add ordereddict to install_requires.
parent
27cab9651e
commit
cc59df2ca3
|
@ -25,12 +25,9 @@ from __future__ import absolute_import
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# py2.7+ comes with collections.OrderedDict
|
import collections
|
||||||
from collections import OrderedDict
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# py2.6 doesn't; this is an equivalent;
|
import ordereddict as collections
|
||||||
# `pip install ordereddict`
|
|
||||||
from ordereddict import OrderedDict
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -1029,7 +1026,7 @@ class ImportResult(object):
|
||||||
_fields = '''count no_user_id imported imported_rsa unchanged
|
_fields = '''count no_user_id imported imported_rsa unchanged
|
||||||
n_uids n_subk n_sigs n_revoc sec_read sec_imported sec_dups
|
n_uids n_subk n_sigs n_revoc sec_read sec_imported sec_dups
|
||||||
not_imported'''.split()
|
not_imported'''.split()
|
||||||
_counts = OrderedDict(
|
_counts = collections.OrderedDict(
|
||||||
zip(_fields, [int(0) for x in range(len(_fields))]) )
|
zip(_fields, [int(0) for x in range(len(_fields))]) )
|
||||||
|
|
||||||
#: A list of strings containing the fingerprints of the GnuPG keyIDs
|
#: A list of strings containing the fingerprints of the GnuPG keyIDs
|
||||||
|
|
11
setup.py
11
setup.py
|
@ -23,6 +23,7 @@ from __future__ import absolute_import
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import versioneer
|
import versioneer
|
||||||
|
|
||||||
|
@ -37,6 +38,12 @@ __contact__ = 'isis@patternsinthevoid.net'
|
||||||
__url__ = 'https://github.com/isislovecruft/python-gnupg'
|
__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():
|
def get_requirements():
|
||||||
"""Extract the list of requirements from our requirements.txt.
|
"""Extract the list of requirements from our requirements.txt.
|
||||||
|
|
||||||
|
@ -64,6 +71,10 @@ def get_requirements():
|
||||||
except (IOError, OSError) as error:
|
except (IOError, OSError) as error:
|
||||||
print(error)
|
print(error)
|
||||||
|
|
||||||
|
if python26():
|
||||||
|
# Required to make `collections.OrderedDict` available on Python<=2.6
|
||||||
|
requirements.append('ordereddict==1.1#a0ed854ee442051b249bfad0f638bbec')
|
||||||
|
|
||||||
return requirements, links
|
return requirements, links
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue