Move version 0.01 to Git repo
This commit is contained in:
37
tools/checkdep.py
Executable file
37
tools/checkdep.py
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
Created on 23.10.2010
|
||||
|
||||
@author: Sergey Morozov
|
||||
'''
|
||||
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
modules = ['sys',
|
||||
'os',
|
||||
'MySQLdb',
|
||||
'json',
|
||||
'hashlib',
|
||||
'smtplib',
|
||||
'string',
|
||||
'random',
|
||||
'email',
|
||||
'cgitb',
|
||||
'urlparse',
|
||||
'wsgiref',
|
||||
'cgi']
|
||||
error = False
|
||||
for module in modules:
|
||||
sys.stdout.write('Checking for module %s: ' % module)
|
||||
try:
|
||||
__import__(module)
|
||||
except ImportError:
|
||||
sys.stdout.write('import error\n')
|
||||
error = True
|
||||
else:
|
||||
sys.stdout.write('OK\n')
|
||||
if error == False:
|
||||
sys.stdout.write('\nDependencies check completed successfully.\n\n')
|
||||
else:
|
||||
sys.stdout.write('\nOne or more dependency are not found.\n\n')
|
||||
32
tools/dbinit.py
Executable file
32
tools/dbinit.py
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
Created on 15.09.2010
|
||||
|
||||
@author: Sergey Morozov
|
||||
'''
|
||||
|
||||
import MySQLdb, os, sys
|
||||
toolsdir = os.path.dirname(__file__)
|
||||
if toolsdir == '':
|
||||
toolsdir = '.'
|
||||
serverdir = toolsdir + os.sep + '..'
|
||||
sys.path.append(serverdir)
|
||||
sys.path.append(serverdir + os.sep + 'include')
|
||||
import config
|
||||
|
||||
if __name__ == '__main__':
|
||||
db = MySQLdb.connect(
|
||||
host = config.mysql_server,
|
||||
user = config.mysql_user,
|
||||
passwd = config.mysql_password,
|
||||
db = config.mysql_database,
|
||||
port = int(config.mysql_port)
|
||||
)
|
||||
cursor = db.cursor()
|
||||
q = "CREATE TABLE IF NOT EXISTS `users` "\
|
||||
"(`email` VARCHAR( 40 ) NOT NULL, "\
|
||||
"`password` VARCHAR( 40 ) NOT NULL, "\
|
||||
"`jsondata` TEXT NOT NULL, "\
|
||||
"`pwkey` VARCHAR( 20 ) NULL, "\
|
||||
"PRIMARY KEY ( `email` ))"
|
||||
cursor.execute(q)
|
||||
Reference in New Issue
Block a user