correct installation for Linux
authorymh <ymh.work@gmail.com>
Fri, 04 Jun 2010 17:43:28 +0200
changeset 42 f5f3563d43fa
parent 40 35d2eacbb4cb
child 43 f4b9ce48a758
correct installation for Linux
sbin/create_python_env.py
sbin/res/src/distribute-0.6.13.tar.gz
web/blinkster/settings.py
--- a/sbin/create_python_env.py	Thu Jun 03 17:44:45 2010 +0200
+++ b/sbin/create_python_env.py	Fri Jun 04 17:43:28 2010 +0200
@@ -38,11 +38,12 @@
 
 EXTRA_TEXT  = "URLS = { \n"
 
-EXTRA_TEXT += "    'PSYCOPG2' : { 'url': 'http://initd.org/pub/software/psycopg/psycopg2-2.2.1.tar.gz', 'local': '"+ os.path.abspath(os.path.join(src_base,"psycopg2-2.2.1.tar.gz"))+"'},\n"
-EXTRA_TEXT += "    'FOURSUITE_XML' : { 'url': 'ftp://ftp.4suite.org/pub/4Suite/4Suite-XML-1.0.2.tar.bz2', 'local': '"+ os.path.abspath(os.path.join(src_base,"4Suite-XML-1.0.2.tar.bz2"))+"'},\n"
-EXTRA_TEXT += "    'PYLUCENE' : { 'url': 'http://apache.crihan.fr/dist/lucene/pylucene/pylucene-3.0.1-1-src.tar.gz', 'local': '"+ os.path.abspath(os.path.join(src_base,"pylucene-3.0.1-1-src.tar.gz"))+"'},\n"
-EXTRA_TEXT += "    'PIL' : { 'url': 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz', 'local': '"+ os.path.abspath(os.path.join(src_base,"Imaging-1.1.7.tar.gz"))+"'},\n"
-EXTRA_TEXT += "    'PYXML' : { 'url': 'http://sourceforge.net/projects/pyxml/files/pyxml/0.8.4/PyXML-0.8.4.tar.gz/download', 'local': '"+ os.path.abspath(os.path.join(src_base,"PyXML-0.8.4.tar.gz"))+"', 'patch': '"+os.path.join(patch_path,"pyxml.patch")+"'},\n"
+EXTRA_TEXT += "    'DISTRIBUTE' : { 'setup': 'distribute', 'url': 'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.13.tar.gz', 'local': '"+ os.path.abspath(os.path.join(src_base,"distribute-0.6.13.tar.gz"))+"'},\n"
+EXTRA_TEXT += "    'PSYCOPG2' : { 'setup': 'psycopg2','url': 'http://initd.org/pub/software/psycopg/psycopg2-2.2.1.tar.gz', 'local': '"+ os.path.abspath(os.path.join(src_base,"psycopg2-2.2.1.tar.gz"))+"'},\n"
+EXTRA_TEXT += "    'FOURSUITE_XML' : { 'setup': '4Suite-XML', 'url': 'ftp://ftp.4suite.org/pub/4Suite/4Suite-XML-1.0.2.tar.bz2', 'local': '"+ os.path.abspath(os.path.join(src_base,"4Suite-XML-1.0.2.tar.bz2"))+"'},\n"
+EXTRA_TEXT += "    'PYLUCENE' : { 'setup': 'http://apache.crihan.fr/dist/lucene/pylucene/pylucene-3.0.1-1-src.tar.gz', 'url': 'http://apache.crihan.fr/dist/lucene/pylucene/pylucene-3.0.1-1-src.tar.gz', 'local': '"+ os.path.abspath(os.path.join(src_base,"pylucene-3.0.1-1-src.tar.gz"))+"'},\n"
+EXTRA_TEXT += "    'PIL' : { 'setup': 'pil', 'url': 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz', 'local': '"+ os.path.abspath(os.path.join(src_base,"Imaging-1.1.7.tar.gz"))+"'},\n"
+EXTRA_TEXT += "    'PYXML' : { 'setup': 'http://sourceforge.net/projects/pyxml/files/pyxml/0.8.4/PyXML-0.8.4.tar.gz/download', 'url': 'http://sourceforge.net/projects/pyxml/files/pyxml/0.8.4/PyXML-0.8.4.tar.gz/download', 'local': '"+ os.path.abspath(os.path.join(src_base,"PyXML-0.8.4.tar.gz"))+"', 'patch': '"+os.path.join(patch_path,"pyxml.patch")+"'},\n"
 
 EXTRA_TEXT += "}\n"
 
@@ -69,12 +70,11 @@
         default='',
         help='base URL of Python Package Index')
     parser.add_option(
-        '--local',
-        metavar='LOCAL',
-        dest='local',
-        action="store_true",
-        default=False,
-        help='base URL of Python Package Index')
+        '--type_install',
+        metavar='type_install',
+        dest='type_install',
+        default='local',
+        help='type install : local, url, setup')
 
 
 def adjust_options(options, args):
@@ -82,58 +82,19 @@
 
 
 def after_install(options, home_dir):
+    home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
     base_dir = os.path.dirname(home_dir)
     src_dir = join(home_dir, 'src')
     tmp_dir = join(home_dir, 'tmp')
     ensure_dir(src_dir)
     ensure_dir(tmp_dir)
+    system_str = platform.system()
     
-    res_source_key = "local" if options.local else "url"
+    res_source_key = options.typs_install
     
     logger.indent += 2
     try:
-        call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['PSYCOPG2'][res_source_key]],
-                        cwd=os.path.abspath(tmp_dir),
-                        filter_stdout=filter_python_develop,
-                        show_stdout=True)
-
-        call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['PIL'][res_source_key]],
-                        cwd=os.path.abspath(tmp_dir),
-                        filter_stdout=filter_python_develop,
-                        show_stdout=True)
-
-        call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), URLS['FOURSUITE_XML'][res_source_key]],
-                        cwd=os.path.abspath(tmp_dir),
-                        filter_stdout=filter_python_develop,
-                        show_stdout=True)
-
         
-        if sys.version_info >= (2,6):
-            pyxml_src = os.path.join(src_dir,"pyxml.tar.gz")
-            urllib.urlretrieve(URLS['PYXML'][res_source_key], pyxml_src)
-            tf = tarfile.open(pyxml_src,'r:gz')
-            pyxml_base_path = os.path.join(src_dir,"pyxml") 
-            tf.extractall(pyxml_base_path)
-            tf.close()
-            #patch
-            pyxml_version = os.listdir(pyxml_base_path)[0]            
-            pyxml_path = os.path.join(pyxml_base_path, pyxml_version)
-            olddir = os.getcwd()
-            os.chdir(pyxml_path)
-            p = patch.fromfile(URLS['PYXML']['patch'])
-            p.apply()
-            os.chdir(olddir)
-            call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), '--build='+os.path.abspath(pyxml_base_path), '--no-download', pyxml_version],
-                    cwd=os.path.abspath(tmp_dir),
-                    filter_stdout=filter_python_develop,
-                    show_stdout=True)
-        else:
-            call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['PYXML'][res_source_key]],
-                    cwd=os.path.abspath(tmp_dir),
-                    filter_stdout=filter_python_develop,
-                    show_stdout=True)
-        
-
         #get pylucene
         pylucene_src = os.path.join(src_dir,"pylucene.tar.gz")
         urllib.urlretrieve(URLS['PYLUCENE'][res_source_key], pylucene_src)
@@ -143,10 +104,21 @@
         tf.close()
         
         pylucene_src_path = os.path.join(pylucene_base_path, os.listdir(pylucene_base_path)[0])
+        jcc_src_path = os.path.abspath(os.path.join(pylucene_src_path,"jcc"))
         
         #install jcc
+
+        #patch for linux
+        if system_str = 'Linux' :
+            olddir = os.getcwd()
+            os.chdir(os.path.join(lib_dir,'site-packages','setuptools-0.6c11-py'+'%s.%s' % (sys.version_info[0], sys.version_info[1])+'.egg'))
+            p = patch.fromfile(os.path.join(jcc_src_path,"jcc","patches","patch.43.0.6c11")
+            p.apply()
+            os.chdir(olddir)
+
+                
         call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'python')), 'setup.py', 'install'],
-                        cwd=os.path.abspath(os.path.join(pylucene_src_path,"jcc")),
+                        cwd=jcc_src_path,
                         filter_stdout=filter_python_develop,
                         show_stdout=True)
         #install pylucene       
@@ -159,7 +131,7 @@
         destination.write("PREFIX_PYTHON="+os.path.abspath(home_dir)+"\\n")
         destination.write("ANT=ant\\n")
         destination.write("PYTHON=$(PREFIX_PYTHON)/bin/python\\n")
-        system_str = platform.system()
+        
         if system_str == "Darwin":
             if sys.version_info >= (2,6):
                 destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\\n")
@@ -187,6 +159,53 @@
                         cwd=os.path.abspath(pylucene_src_path),
                         filter_stdout=filter_python_develop,
                         show_stdout=True)
+
+        if sys.version_info >= (2,6):
+            pyxml_src = os.path.join(src_dir,"pyxml.tar.gz")
+            urllib.urlretrieve(URLS['PYXML'][res_source_key], pyxml_src)
+            tf = tarfile.open(pyxml_src,'r:gz')
+            pyxml_base_path = os.path.join(src_dir,"pyxml") 
+            tf.extractall(pyxml_base_path)
+            tf.close()
+            #patch
+            pyxml_version = os.listdir(pyxml_base_path)[0]            
+            pyxml_path = os.path.join(pyxml_base_path, pyxml_version)
+            olddir = os.getcwd()
+            os.chdir(pyxml_path)
+            p = patch.fromfile(URLS['PYXML']['patch'])
+            p.apply()
+            os.chdir(olddir)
+            call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), '--build='+os.path.abspath(pyxml_base_path), '--no-download', pyxml_version],
+                    cwd=os.path.abspath(tmp_dir),
+                    filter_stdout=filter_python_develop,
+                    show_stdout=True)
+        else:
+            call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['PYXML'][res_source_key]],
+                    cwd=os.path.abspath(tmp_dir),
+                    filter_stdout=filter_python_develop,
+                    show_stdout=True)
+        
+                        
+        call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['DISTRIBUTE'][res_source_key]],
+                        cwd=os.path.abspath(tmp_dir),
+                        filter_stdout=filter_python_develop,
+                        show_stdout=True)
+                        
+        call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['PSYCOPG2'][res_source_key]],
+                        cwd=os.path.abspath(tmp_dir),
+                        filter_stdout=filter_python_develop,
+                        show_stdout=True)
+
+        call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), URLS['PIL'][res_source_key]],
+                        cwd=os.path.abspath(tmp_dir),
+                        filter_stdout=filter_python_develop,
+                        show_stdout=True)
+
+        call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), URLS['FOURSUITE_XML'][res_source_key]],
+                        cwd=os.path.abspath(tmp_dir),
+                        filter_stdout=filter_python_develop,
+                        show_stdout=True)
+                        
         shutil.rmtree(src_dir)
 
     finally:
Binary file sbin/res/src/distribute-0.6.13.tar.gz has changed
--- a/web/blinkster/settings.py	Thu Jun 03 17:44:45 2010 +0200
+++ b/web/blinkster/settings.py	Fri Jun 04 17:43:28 2010 +0200
@@ -12,12 +12,17 @@
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = ''             # Or path to database file if using sqlite3.
-DATABASE_USER = ''             # Not used with sqlite3.
-DATABASE_PASSWORD = ''         # Not used with sqlite3.
-DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
+DATABASES = {
+    'default': {
+        'NAME'     : '',
+        'ENGINE'   : '',
+        'USER'     : '',             # Not used with sqlite3.
+        'PASSWORD' : '',        # Not used with sqlite3.
+        'HOST'     : '',             # Set to empty string for localhost. Not used with sqlite3.
+        'PORT'     : '',             # Set to empty string for default. Not used with sqlite3.
+    }
+}
+
 
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name