From 95ebf7f6759155e85e6bc47e8ecd088aa0ab2619 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9gis=20Behmo?= <regis@behmo.com>
Date: Tue, 24 Mar 2015 15:27:10 +0100
Subject: [PATCH] Upgrade distribute to the latest stable version of setuptools

'distribute' is the ancestor of 'setuptools', and many packages require
setuptools to be installed.

Upgrade of MySQL-python from 1.2.4 to 1.2.5 is required because of an
incompatibility with setuptools>0.7.
---
 common/lib/capa/setup.py    |  2 +-
 common/lib/xmodule/setup.py |  2 +-
 pavelib/prereqs.py          |  1 -
 requirements/edx/base.txt   |  2 +-
 requirements/edx/post.txt   |  9 ---------
 requirements/edx/pre.txt    |  3 +++
 scripts/create-dev-env.sh   | 21 ---------------------
 setup.py                    |  2 +-
 8 files changed, 7 insertions(+), 35 deletions(-)
 delete mode 100644 requirements/edx/post.txt

diff --git a/common/lib/capa/setup.py b/common/lib/capa/setup.py
index dcb631e376e..b9466ca1019 100644
--- a/common/lib/capa/setup.py
+++ b/common/lib/capa/setup.py
@@ -4,5 +4,5 @@ setup(
     name="capa",
     version="0.1",
     packages=find_packages(exclude=["tests"]),
-    install_requires=["distribute>=0.6.28"],
+    install_requires=["setuptools"],
 )
diff --git a/common/lib/xmodule/setup.py b/common/lib/xmodule/setup.py
index fedb0e4447d..e1e50daf981 100644
--- a/common/lib/xmodule/setup.py
+++ b/common/lib/xmodule/setup.py
@@ -54,7 +54,7 @@ setup(
     version="0.1",
     packages=find_packages(exclude=["tests"]),
     install_requires=[
-        'distribute',
+        'setuptools',
         'docopt',
         'capa',
         'path.py',
diff --git a/pavelib/prereqs.py b/pavelib/prereqs.py
index 220a5387c4e..4219a9a58b6 100644
--- a/pavelib/prereqs.py
+++ b/pavelib/prereqs.py
@@ -16,7 +16,6 @@ PYTHON_REQ_FILES = [
     'requirements/edx/github.txt',
     'requirements/edx/local.txt',
     'requirements/edx/base.txt',
-    'requirements/edx/post.txt',
 ]
 
 # Developers can have private requirements, for local copies of github repos,
diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt
index 60a8d62c27b..d25e3427ec7 100644
--- a/requirements/edx/base.txt
+++ b/requirements/edx/base.txt
@@ -13,7 +13,6 @@ celery==3.1.18
 cssselect==0.9.1
 dealer==2.0.4
 defusedxml==0.4.1
-distribute>=0.6.28, <0.7
 django-babel-underscore==0.1.0
 django-celery==3.1.16
 django-countries==3.3
@@ -52,6 +51,7 @@ Markdown==2.2.1
 --allow-unverified meliae
 meliae==0.4.0
 mongoengine==0.7.10
+MySQL-python==1.2.5
 networkx==1.7
 nltk==2.0.5
 nose==1.3.3
diff --git a/requirements/edx/post.txt b/requirements/edx/post.txt
deleted file mode 100644
index 202784390cf..00000000000
--- a/requirements/edx/post.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# DON'T JUST ADD NEW DEPENDENCIES!!!
-#
-# If you open a pull request that adds a new dependency, you should notify:
-#   * @mollydb to check licensing
-#   * One of @e0d, @feanil, @fredsmith, @maxrothman, or @jibsheet
-#     to check system requirements
-
-# This must be installed after distribute has been updated.
-MySQL-python==1.2.4
diff --git a/requirements/edx/pre.txt b/requirements/edx/pre.txt
index 89bfe09890d..5efe8978384 100644
--- a/requirements/edx/pre.txt
+++ b/requirements/edx/pre.txt
@@ -5,6 +5,9 @@
 #   * One of @e0d, @feanil, @fredsmith, @maxrothman, or @jibsheet
 #     to check system requirements
 
+# Use a modern setuptools instead of distribute
+setuptools==18.0.1
+
 # Numpy and scipy can't be installed in the same pip run.
 # Install numpy before other things to help resolve the problem.
 numpy==1.6.2
diff --git a/scripts/create-dev-env.sh b/scripts/create-dev-env.sh
index 7f7c9f94d10..75b32feacc8 100755
--- a/scripts/create-dev-env.sh
+++ b/scripts/create-dev-env.sh
@@ -441,27 +441,6 @@ if [[ -n $compile ]]; then
     rm -rf numpy-${NUMPY_VER} scipy-${SCIPY_VER}
 fi
 
-# building correct version of distribute from source
-DISTRIBUTE_VER="0.6.28"
-output "Building Distribute"
-SITE_PACKAGES="$WORKON_HOME/edx-platform/lib/python2.7/site-packages"
-cd "$SITE_PACKAGES"
-curl -sSLO http://pypi.python.org/packages/source/d/distribute/distribute-${DISTRIBUTE_VER}.tar.gz
-tar -xzvf distribute-${DISTRIBUTE_VER}.tar.gz
-cd distribute-${DISTRIBUTE_VER}
-python setup.py install
-cd ..
-rm distribute-${DISTRIBUTE_VER}.tar.gz
-
-DISTRIBUTE_VERSION=`pip freeze | grep distribute`
-
-if [[ "$DISTRIBUTE_VERSION" == "distribute==0.6.28" ]]; then
-  output "Distribute successfully installed"
-else
-  error "Distribute failed to build correctly. This script requires a working version of Distribute 0.6.28 in your virtualenv's python installation"
-  exit 1
-fi
-
 case `uname -s` in
     Darwin)
         # on mac os x get the latest distribute and pip
diff --git a/setup.py b/setup.py
index 6dbbdd90aa4..1b2ef6ec30e 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ from setuptools import setup
 setup(
     name="Open edX",
     version="0.4",
-    install_requires=["distribute"],
+    install_requires=["setuptools"],
     requires=[],
     # NOTE: These are not the names we should be installing.  This tree should
     # be reorganized to be a more conventional Python tree.
-- 
GitLab