Browse Source

python: split installer function.

INADA Naoki 12 years ago
parent
commit
ced51dd60f
1 changed files with 65 additions and 76 deletions
  1. 65 76
      installer.py

+ 65 - 76
installer.py

@@ -38,6 +38,8 @@ class Installer:
     # Languages
     # Languages
     #######################################
     #######################################
 
 
+    self._install_python()
+
     #
     #
     # Dart
     # Dart
     #
     #
@@ -51,45 +53,6 @@ class Installer:
     self.__run_command("sudo apt-get update")
     self.__run_command("sudo apt-get update")
     self.__run_command("sudo apt-get install esl-erlang", True)
     self.__run_command("sudo apt-get install esl-erlang", True)
 
 
-    #
-    # Python
-    #
-    
-    # .profile is not loaded yet. So we should use full path.
-    pypy_bin   = "~/FrameworkBenchmarks/installs/pypy-2.0.2/bin"
-    python_bin = "~/FrameworkBenchmarks/installs/python-2.7.5/bin"
-    python3_bin= "~/FrameworkBenchmarks/installs/python-3.3.2/bin"
-    def easy_install(pkg, two=True, three=False, pypy=False):
-        cmd = "/easy_install -U '" + pkg + "'"
-        if two:   self.__run_command(python_bin + cmd)
-        if three: self.__run_command(python3_bin + cmd)
-        if pypy:  self.__run_command(pypy_bin + cmd)
-
-    self.__run_command("curl -L http://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-linux64.tar.bz2 | tar xj")
-    self.__run_command("curl -L http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz | tar xz")
-    self.__run_command("curl -L http://www.python.org/ftp/python/3.3.2/Python-3.3.2.tar.xz | tar xJ")
-    self.__run_command("./configure --prefix=$HOME/FrameworkBenchmarks/installs/python-2.7.5 --disable-shared", cwd="Python-2.7.5")
-    self.__run_command("./configure --prefix=$HOME/FrameworkBenchmarks/installs/python-3.3.2 --disable-shared", cwd="Python-3.3.2")
-    self.__run_command("make -j", cwd="Python-2.7.5")
-    self.__run_command("make install", cwd="Python-2.7.5")
-    self.__run_command("make -j", cwd="Python-3.3.2")
-    self.__run_command("make install", cwd="Python-3.3.2")
-
-    self.__run_command("wget https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py")
-    self.__run_command(pypy_bin + "/pypy ez_setup.py")
-    self.__run_command(python_bin + "/python ez_setup.py")
-    self.__run_command(python3_bin + "/python3 ez_setup.py")
-
-    easy_install('pip==1.3.1', two=True, three=True, pypy=True)
-    easy_install('MySQL-python==1.2.4', two=True, three=False, pypy=True)
-    easy_install('https://github.com/clelland/MySQL-for-Python-3/archive/master.zip',
-                 two=False, three=False, pypy=False)
-    easy_install('PyMySQL==0.5', pypy=True)
-    easy_install('PyMySQL3==0.5', two=False, three=True)
-    easy_install('simplejson==3.3.0', two=True, three=True, pypy=False)
-    easy_install('psycopg2-2.5.1', three=True)
-    easy_install('ujson==1.33', three=True)
-
     #
     #
     # nodejs
     # nodejs
     #
     #
@@ -231,15 +194,6 @@ class Installer:
     self.__run_command("make", cwd="ngx_openresty-1.2.7.5")
     self.__run_command("make", cwd="ngx_openresty-1.2.7.5")
     self.__run_command("sudo make install", cwd="ngx_openresty-1.2.7.5")
     self.__run_command("sudo make install", cwd="ngx_openresty-1.2.7.5")
 
 
-    #
-    # Gunicorn
-    #
-
-    easy_install('gunicorn==17.5', two=True, three=True, pypy=True)
-    # meinheld HEAD supports gunicorn worker on Python 3
-    easy_install('https://github.com/mopemope/meinheld/archive/master.zip',
-                 two=True, three=True, pypy=True)
-
     #
     #
     # Resin
     # Resin
     #
     #
@@ -260,18 +214,6 @@ class Installer:
     #
     #
     ##############################################################
     ##############################################################
 
 
-    ##############################
-    # Tornado
-    ##############################
-    easy_install('tornado==3.1', two=True, three=True, pypy=True)
-    easy_install('motor==0.1.1', two=True, three=True, pypy=True)
-    easy_install('pymongo==2.5.2', two=True, three=True, pypy=True)
-
-    ##############################
-    # Django
-    ##############################
-    easy_install("https://www.djangoproject.com/download/1.6b1/tarball/", two=True, three=True, pypy=True)
-
     ##############################
     ##############################
     # Grails
     # Grails
     ##############################
     ##############################
@@ -279,22 +221,6 @@ class Installer:
     self.__run_command("unzip -o grails-2.1.1.zip")
     self.__run_command("unzip -o grails-2.1.1.zip")
     self.__run_command("rm grails-2.1.1.zip")
     self.__run_command("rm grails-2.1.1.zip")
 
 
-
-    ##############################
-    # Flask
-    ##############################
-    easy_install('Werkzeug==0.9.2', two=True, three=True, pypy=True)
-    easy_install('flask==0.10.1', two=True, three=True, pypy=True)
-    easy_install('sqlalchemy==0.8.2', two=True, three=True, pypy=True)
-    easy_install('Jinja2==2.7', two=True, three=True, pypy=True)
-    easy_install('Flask-SQLAlchemy==1.0', two=True, three=True, pypy=True)
-
-    ##############################
-    # Bottle
-    ##############################
-    easy_install('bottle==0.11.6', two=True, three=True, pypy=True)
-    easy_install('bottle-sqlalchemy==0.4', two=True, three=True, pypy=True)
-
     ##############################
     ##############################
     # Play 2
     # Play 2
     ##############################
     ##############################
@@ -365,6 +291,68 @@ class Installer:
   # End __install_server_software
   # End __install_server_software
   ############################################################
   ############################################################
 
 
+  def _install_python(self):
+    # .profile is not loaded yet. So we should use full path.
+    pypy_bin   = "~/FrameworkBenchmarks/installs/pypy-2.0.2/bin"
+    python_bin = "~/FrameworkBenchmarks/installs/python-2.7.5/bin"
+    python3_bin= "~/FrameworkBenchmarks/installs/python-3.3.2/bin"
+    def easy_install(pkg, two=True, three=False, pypy=False):
+      cmd = "/easy_install -U '" + pkg + "'"
+      if two:   self.__run_command(python_bin + cmd)
+      if three: self.__run_command(python3_bin + cmd)
+      if pypy:  self.__run_command(pypy_bin + cmd)
+
+    self.__run_command("curl -L http://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-linux64.tar.bz2 | tar xj")
+    self.__run_command("curl -L http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz | tar xz")
+    self.__run_command("curl -L http://www.python.org/ftp/python/3.3.2/Python-3.3.2.tar.xz | tar xJ")
+    self.__run_command("./configure --prefix=$HOME/FrameworkBenchmarks/installs/python-2.7.5 --disable-shared", cwd="Python-2.7.5")
+    self.__run_command("./configure --prefix=$HOME/FrameworkBenchmarks/installs/python-3.3.2 --disable-shared", cwd="Python-3.3.2")
+    self.__run_command("make -j", cwd="Python-2.7.5")
+    self.__run_command("make install", cwd="Python-2.7.5")
+    self.__run_command("make -j", cwd="Python-3.3.2")
+    self.__run_command("make install", cwd="Python-3.3.2")
+
+    self.__run_command("wget https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py")
+    self.__run_command(pypy_bin + "/pypy ez_setup.py")
+    self.__run_command(python_bin + "/python ez_setup.py")
+    self.__run_command(python3_bin + "/python3 ez_setup.py")
+
+    easy_install('pip==1.3.1', two=True, three=True, pypy=True)
+    easy_install('MySQL-python==1.2.4', two=True, three=False, pypy=True)
+    easy_install('https://github.com/clelland/MySQL-for-Python-3/archive/master.zip',
+                 two=False, three=False, pypy=False)
+    easy_install('PyMySQL==0.5', pypy=True)
+    easy_install('PyMySQL3==0.5', two=False, three=True)
+    easy_install('simplejson==3.3.0', two=True, three=True, pypy=False)
+    easy_install('psycopg2-2.5.1', three=True)
+    easy_install('ujson==1.33', three=True)
+
+    # Gunicorn
+    easy_install('gunicorn==17.5', two=True, three=True, pypy=True)
+    # meinheld HEAD supports gunicorn worker on Python 3
+    easy_install('https://github.com/mopemope/meinheld/archive/master.zip',
+                 two=True, three=True, pypy=True)
+
+    # Tornado
+    easy_install('tornado==3.1', two=True, three=True, pypy=True)
+    easy_install('motor==0.1.1', two=True, three=True, pypy=True)
+    easy_install('pymongo==2.5.2', two=True, three=True, pypy=True)
+
+    # Django
+    easy_install("https://www.djangoproject.com/download/1.6b1/tarball/", two=True, three=True, pypy=True)
+
+    # Flask
+    easy_install('Werkzeug==0.9.2', two=True, three=True, pypy=True)
+    easy_install('flask==0.10.1', two=True, three=True, pypy=True)
+    easy_install('sqlalchemy==0.8.2', two=True, three=True, pypy=True)
+    easy_install('Jinja2==2.7', two=True, three=True, pypy=True)
+    easy_install('Flask-SQLAlchemy==1.0', two=True, three=True, pypy=True)
+
+    # Bottle
+    easy_install('bottle==0.11.6', two=True, three=True, pypy=True)
+    easy_install('bottle-sqlalchemy==0.4', two=True, three=True, pypy=True)
+
+
   ############################################################
   ############################################################
   # __install_client_software
   # __install_client_software
   ############################################################
   ############################################################
@@ -490,3 +478,4 @@ class Installer:
   # End __init__
   # End __init__
   ############################################################
   ############################################################
 
 
+# vim: sw=2