compile_methods.py - shmolyneaux/SquareJam GitHub Wiki
The compile methods script is one of the most simple examples of how pstorage can be used outside of SnakeCharmer and stosh. It goes through the database compiling every method. This is created because there are binary incompatibilities if they are precompiled.
The whole source code is as follows:
import pstorage;
import os;
import getpass;
password = getpass.getpass( "Enter root password: " );
storage = pstorage.Storage( '127.0.0.1' );
storage.login( 'root', password );
for dirpath, dirnames, filenames in os.walk("storserv_data"):
print(dirpath);
if "method_text" in filenames:
#Method found and needs to be compiled
method = dirpath.replace('/', '.');
method = method.replace('storserv_data', 'storage');
method = method + ".compile()";
print("executing:\t" + method + '\n');
exec(method);