diff --git a/README.rst b/README.rst index d16c649ff..22daa1742 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,7 @@ If you have `setuptools `_ i Dependencies ============ -The PyMongo distribution has been tested on both Python 2.5 and Python 2.6. Additional dependencies are: +The PyMongo distribution has been tested on Python 2.x, where x >= 4. Additional dependencies are: - `ElementTree `_ (this is included with Python >= 2.5) - (to generate documentation) `epydoc `_ diff --git a/pymongo/son.py b/pymongo/son.py index 4faa2f3ae..0be126fe5 100644 --- a/pymongo/son.py +++ b/pymongo/son.py @@ -25,7 +25,7 @@ import base64 try: import xml.etree.ElementTree as ET -except: +except ImportError: import elementtree.ElementTree as ET from code import Code diff --git a/setup.py b/setup.py index 0c372393d..755920434 100755 --- a/setup.py +++ b/setup.py @@ -10,6 +10,12 @@ from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError from distutils.core import Extension +requirements = [] +try: + import xml.etree.ElementTree +except ImportError: + requirements.append("elementtree") + f = open("README.rst") try: try: @@ -47,7 +53,7 @@ setup( url="http://github.com/mongodb/mongo-python-driver", packages=["pymongo", "gridfs"], ext_modules=[Extension('pymongo._cbson', ['pymongo/_cbsonmodule.c'])], - install_requires=["elementtree"], + install_requires=requirements, license="Apache License, Version 2.0", test_suite="nose.collector", classifiers=[