Index: setup.py
===================================================================
--- setup.py	(revision 6789)
+++ setup.py	(working copy)
@@ -1,7 +1,11 @@
-from distutils.core import setup
-from distutils.command.install import INSTALL_SCHEMES
-import os
-import sys
+import os, sys
+try:
+    from setuptools import setup
+except ImportError:
+    from distutils.core import setup
+    use_setuptools = False
+else:
+    use_setuptools = True
 
 def fullsplit(path, result=None):
     """
@@ -17,11 +21,37 @@
         return result
     return fullsplit(head, [tail] + result)
 
-# Tell distutils to put the data_files in platform-specific installation
-# locations. See here for an explanation:
-# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
-for scheme in INSTALL_SCHEMES.values():
-    scheme['data'] = scheme['purelib']
+setuptools_options = {}
+version_tuple = __import__('django').VERSION
+if use_setuptools:
+    # Additional arguments for use with setuptools
+    setuptools_options = dict(
+        install_requires = ['setuptools>=0.6c7', 'Flup'],
+        extras_require = {
+            'MySQL':  ["MySQLdb>=1.2.1p2"],
+            'SQLite': ["pysqlite>=2.0.3"],
+            'PostgreSQL': ["psycopg>=1.1.21"],
+            'PostgreSQL2': ["psycopg2>=2.0.5"],
+            'Oracle': ["cx_Oracle>=4.3.1"],
+            'PyYaml': ["PyYaml"],
+        },
+        zip_safe = False,
+    )
+    # Dynamically calculate the version based on django.VERSION but leave out
+    # any non-int part, to use tag_build and tag_svn_revision from setup.cfg
+    version = '.'.join([str(i) for i in version_tuple if type(i) == int])
+else:
+    # Dynamically calculate the version based on django.VERSION.
+    if version_tuple[2] is not None:
+        version = "%d.%d_%s" % version_tuple
+    else:
+        version = "%d.%d" % version_tuple[:2]
+    # Tell distutils to put the data_files in platform-specific installation
+    # locations. See here for an explanation:
+    # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
+    from distutils.command.install import INSTALL_SCHEMES
+    for scheme in INSTALL_SCHEMES.values():
+        scheme['data'] = scheme['purelib']
 
 # Compile the list of packages available, because distutils doesn't have
 # an easy way to do this.
@@ -43,21 +73,17 @@
     elif filenames:
         data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
 
-# Dynamically calculate the version based on django.VERSION.
-version_tuple = __import__('django').VERSION
-if version_tuple[2] is not None:
-    version = "%d.%d_%s" % version_tuple
-else:
-    version = "%d.%d" % version_tuple[:2]
-
 setup(
     name = "Django",
     version = version,
     url = 'http://www.djangoproject.com/',
+    download_url = 'http://www.djangoproject.com/download/',
+    license = 'BSD',
     author = 'Lawrence Journal-World',
     author_email = 'holovaty@gmail.com',
     description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
     packages = packages,
     data_files = data_files,
     scripts = ['django/bin/django-admin.py'],
+    **setuptools_options
 )
Index: docs/install.txt
===================================================================
--- docs/install.txt	(revision 6789)
+++ docs/install.txt	(working copy)
@@ -224,6 +224,72 @@
 command ``svn update`` from within the ``django-trunk`` directory. When you do
 this, Subversion will automatically download any changes.
 
+Using setuptools' ``develop`` command
+-------------------------------------
+
+**New in Django development version**
+
+If you already installed setuptools_ you can skip step 3 and 4 of the
+instructions above and use the ``develop`` command of setuptools instead::
+
+    python setup.py develop
+
+This adds a special file automatically to your system's ``site-packages``
+directory and enables the Python intepreter to find the Django checkout
+without the need to create a symbolic link or to set the ``PYTHONPATH``
+environment variable. This is also platform-independent.
+
+Installing using easy_install
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**New in Django development version**
+
+If you want to benefit from setuptools_'s package management and dependency
+tracking, don't hesitate to install Django with easy_install_.
+
+1. Make sure that you have Subversion_ and setuptools_ installed, and that you
+   can run its commands from a shell. (Enter ``svn help`` or
+   ``easy_install --help`` at a shell prompt to test this.)
+
+2. Install Django's main development branch (the 'trunk') like so::
+
+    easy_install http://code.djangoproject.com/svn/django/trunk/
+
+   The above line checks out Django's source automatically and runs
+   ``python setup.py install`` for you.
+   
+This also works with Django's latest offical version or any other release 
+available at the `Python Package Index`_::
+
+    easy_install Django
+    easy_install Django==0.95.2
+    easy_install Django==0.90
+
+The Django source packages includes not only files with the actual code but
+also documentation, an example project and some extras. If you want to examine
+these files or use setuptools' ``develop`` command, tell easy_install_ to
+automatically extract the package after download to a given directory::
+
+    easy_install -eb /path/to/django-source Django
+
+Once you are ready to install Django from these source files, just rerun
+easy_install_ with that directory as the target::
+
+    easy_install /path/to/django-source
+
+If you want setuptools to install one of several recommended extras or a
+Python database binding during Django's installation, you can also use
+easy_install_ like this::
+
+    easy_install Django[PostgreSQL]
+    easy_install Django[SQLite, PyYaml]
+
+To see a full list of the available extras, open ``setup.py`` and look at the
+``extras_require`` keyword.
+
+
 .. _`download page`: http://www.djangoproject.com/download/
 .. _Subversion: http://subversion.tigris.org/
 .. _from the Control Panel: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx
+.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
+.. _`Python Package Index`: http://pypi.python.org/
+.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall
Index: docs/model-api.txt
===================================================================
--- docs/model-api.txt	(revision 6789)
+++ docs/model-api.txt	(working copy)
@@ -2050,8 +2050,13 @@
 Do this by editing your settings file and changing the ``INSTALLED_APPS``
 setting to add the name of the module that contains your ``models.py``.
 
+Any module that can be found on the Python module search path, which is defined
+in the environment variable ``PYTHONPATH`` as a list of directory names, is
+allowed. Please note this also applies to so-called `Python eggs`_, a single-file
+distribution format for Python libraries and modules such as Django apps.
+
 For example, if the models for your application live in the module
-``mysite.myapp.models`` (the package structure that is created for an
+``mysite.myapp.models`` (e.g. the package structure that is created for an
 application by the ``manage.py startapp`` script), ``INSTALLED_APPS`` should
 read, in part::
 
@@ -2061,6 +2066,9 @@
         #...
     )
 
+.. _`Python eggs`: http://peak.telecommunity.com/DevCenter/PythonEggs
+.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
+
 Providing initial SQL data
 ==========================
 
Index: setup.cfg
===================================================================
--- setup.cfg	(revision 6789)
+++ setup.cfg	(working copy)
@@ -2,3 +2,6 @@
 doc_files = docs examples extras AUTHORS INSTALL LICENSE README
 install-script = scripts/rpm-install.sh
 
+[egg_info]
+tag_build = pre
+tag_svn_revision = 1
