[Python-checkins] r61888 - doctools/trunk/CHANGES doctools/trunk/setup.py

georg.brandl python-checkins at python.org
Tue Mar 25 12:01:28 CET 2008


Author: georg.brandl
Date: Tue Mar 25 12:01:28 2008
New Revision: 61888

Modified:
   doctools/trunk/CHANGES
   doctools/trunk/setup.py
Log:
* setup: On Python 2.4, don't egg-depend on docutils if a docutils is
  already installed -- else it will be overwritten.



Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Tue Mar 25 12:01:28 2008
@@ -13,6 +13,9 @@
 * sphinx.builder: Handle unavailability of TOC relations (previous/
   next chapter) more gracefully in the HTML builder.
 
+* setup: On Python 2.4, don't egg-depend on docutils if a docutils is
+  already installed -- else it will be overwritten.
+
 
 Release 0.1.61843 (Mar 24, 2008)
 ================================

Modified: doctools/trunk/setup.py
==============================================================================
--- doctools/trunk/setup.py	(original)
+++ doctools/trunk/setup.py	Tue Mar 25 12:01:28 2008
@@ -1,10 +1,12 @@
 # -*- coding: utf-8 -*-
 import ez_setup
 ez_setup.use_setuptools()
-import sphinx
 
+import sys
 from setuptools import setup, Feature
 
+import sphinx
+
 long_desc = '''
 Sphinx is a tool that makes it easy to create intelligent and beautiful
 documentation for Python projects (or other documents consisting of
@@ -32,6 +34,25 @@
   and inclusion of appropriately formatted docstrings.
 '''
 
+requires = ['Pygments>=0.8', 'docutils>=0.4']
+
+if sys.version_info < (2, 4):
+    print 'ERROR: Sphinx requires at least Python 2.4 to run.'
+    sys.exit(1)
+
+if sys.version_info < (2, 5):
+    # Python 2.4's distutils doesn't automatically install an egg-info,
+    # so an existing docutils install won't be detected -- in that case,
+    # remove the dependency from setup.py
+    try:
+        import docutils
+        if int(docutils.__version__[2]) < 4:
+            raise ValueError('docutils not recent enough')
+    except:
+        pass
+    else:
+        del requires[-1]
+
 setup(
     name='Sphinx',
     version=sphinx.__version__,
@@ -66,5 +87,5 @@
             'sphinx-quickstart = sphinx.quickstart:main'
         ]
     },
-    install_requires=['Pygments>=0.8', 'docutils>=0.4']
+    install_requires=requires,
 )


More information about the Python-checkins mailing list