[Erp5-report] r33823 rafael - in /erp5/trunk/utils/erp5.recipe.testrunner: ./ src/erp5/reci...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 17 21:57:38 CET 2010


Author: rafael
Date: Wed Mar 17 21:57:35 2010
New Revision: 33823

URL: http://svn.erp5.org?rev=33823&view=rev
Log:
Use erp5.recipe.mysqldatabase to create the database. Increase version.


Modified:
    erp5/trunk/utils/erp5.recipe.testrunner/CHANGES.txt
    erp5/trunk/utils/erp5.recipe.testrunner/README.txt
    erp5/trunk/utils/erp5.recipe.testrunner/setup.py
    erp5/trunk/utils/erp5.recipe.testrunner/src/erp5/recipe/testrunner/__init__.py

Modified: erp5/trunk/utils/erp5.recipe.testrunner/CHANGES.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.testrunner/CHANGES.txt?rev=33823&r1=33822&r2=33823&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.testrunner/CHANGES.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.testrunner/CHANGES.txt [utf8] Wed Mar 17 21:57:35 2010
@@ -1,5 +1,12 @@
 Changelog
 =========
+
+1.0.4 (2010-03-17)
+------------------
+
+ - Use erp5.recipe.mysqldatabase to create the database.
+   [Rafael Monnerat]
+
 
 1.0.3 (2010-03-04)
 ------------------

Modified: erp5/trunk/utils/erp5.recipe.testrunner/README.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.testrunner/README.txt?rev=33823&r1=33822&r2=33823&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.testrunner/README.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.testrunner/README.txt [utf8] Wed Mar 17 21:57:35 2010
@@ -34,3 +34,30 @@
 bt5_path
   Paths containing business templates to be installed
 
+mysql_create_database
+  If true creates the database using the followed extra option.
+  (Starting with mysql_)
+
+mysql_database_name
+  Mysql Database name.
+
+mysql_host
+  Hostname which is running your mysql server. By Default uses localhost.
+  (Optional).
+
+mysql_port
+  Port Number which is running your mysql server. By Default uses 3306.
+  (Optional).
+
+mysql_user
+  User of new database, used to grant privilegies on the new database.
+
+mysql_password
+  User's Password of new database, used to grant privilegies on the new
+  database.
+
+mysql_superuser
+  User of mysql used to connect to mysql server to create the database.
+
+mysql_superpassword
+  Password of user defined at mysql_superuser.

Modified: erp5/trunk/utils/erp5.recipe.testrunner/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.testrunner/setup.py?rev=33823&r1=33822&r2=33823&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.testrunner/setup.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.testrunner/setup.py [utf8] Wed Mar 17 21:57:35 2010
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 
 name = "erp5.recipe.testrunner"
-version = '1.0.3'
+version = '1.0.4'
 
 def read(name):
     return open(name).read()
@@ -30,7 +30,8 @@
       ],
     packages = find_packages('src'),
     package_dir = {'': 'src'},
-    install_requires = ['zc.recipe.egg', ],
+    install_requires = ['zc.recipe.egg', 
+                        'erp5.recipe.mysqldatabase'],
     namespace_packages = ['erp5', 'erp5.recipe'],
     entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
     )

Modified: erp5/trunk/utils/erp5.recipe.testrunner/src/erp5/recipe/testrunner/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.testrunner/src/erp5/recipe/testrunner/__init__.py?rev=33823&r1=33822&r2=33823&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.testrunner/src/erp5/recipe/testrunner/__init__.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.testrunner/src/erp5/recipe/testrunner/__init__.py [utf8] Wed Mar 17 21:57:35 2010
@@ -16,6 +16,7 @@
 import os, re, shutil, sys, glob
 import zc.buildout
 import zc.recipe.egg
+import erp5.recipe.mysqldatabase
 
 class Recipe:
     '''Creates a runUnitTest aware of eggs and custom paths used in this
@@ -128,43 +129,7 @@
         # This was copied from erp5.recipe.standalone
         # XXX This part should be splited to another recipe erp5.recipe.createdatabase 
         if options.get('mysql_create_database', 'false').lower() == 'true':
-            try:
-                import MySQLdb
-            except ImportError:
-                raise ImportError('To be able to create database MySQLdb is required'
-                  ' Install system wide or use software generated python')
-            mysql_database_name, mysql_user, mysql_password, mysql_port, mysql_host\
-                  = \
-                options.get('mysql_database_name'), \
-                options.get('mysql_user'), \
-                options.get('mysql_password'), \
-                options.get('mysql_port'), \
-                options.get('mysql_host')
-      
-            if not (mysql_database_name and mysql_user):
-                raise zc.buildout.UserError('mysql_database_name and mysql_user are '
-                  'required to create database and grant privileges')
-            connection = MySQLdb.connect(
-                host = self.options.get('mysql_host'),
-                port = int(self.options.get('mysql_port')),
-                user = self.options.get('mysql_superuser'),
-                passwd = self.options.get('mysql_superpassword'),
-            )
-            connection.autocommit(0)
-            cursor = connection.cursor()
-            cursor.execute(
-              'CREATE DATABASE IF NOT EXISTS %s DEFAULT CHARACTER SET utf8 COLLATE '
-              'utf8_unicode_ci' % mysql_database_name)
-            privileges = ['GRANT ALL PRIVILEGES ON %s.* TO %s' % (
-                mysql_database_name, mysql_user)]
-      
-            if mysql_host:
-                privileges.append('@%s' % mysql_host)
-            if mysql_password:
-                privileges.append(' IDENTIFIED BY "%s"' % mysql_password)
-            cursor.execute(''.join(privileges))
-            connection.commit()
-            connection.close()
+            erp5.recipe.mysqldatabase.Recipe(self.buildout, self.name, self.options).install()
     
         return [location]
 




More information about the Erp5-report mailing list