slaprunner: fixed revisions for repos
[slapos.git] / software / phpfin / configure-phpfin.py
1 # -*- coding: utf-8 -*-
2 import sys
3 import os
4 import MySQLdb
5
6 def setup(args):
7 renamed, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
8 #base_url, htdocs, renamed, mysql_user, mysql_password, mysql_database, mysql_host = args
9 sql_file = os.path.join(htdocs, "scripts/phpfin.sql")
10 try:
11 conn = MySQLdb.connect (host = mysql_host,
12 user = mysql_user,
13 passwd = mysql_password,
14 db = mysql_database)
15 cursor = conn.cursor ()
16 with open(sql_file, 'r') as f:
17 sql_script = f.read()
18 cursor.execute(sql_script)
19 conn.close()
20 except:
21 return
22
23 if __name__ == '__main__':
24 setup(sys.argv[1:])
25