本文整理汇总了Python中setup_util.replace_text函数的典型用法代码示例。如果您正苦于以下问题:Python replace_text函数的具体用法?Python replace_text怎么用?Python replace_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了replace_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
def start(args):
setup_util.replace_text(
"php-symfony2/app/config/parameters.yml", "database_host: .*", "database_host: " + args.database_host
)
setup_util.replace_text(
"php-symfony2/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks"
)
try:
subprocess.check_call("composer.phar install", shell=True, cwd="php-symfony2")
subprocess.check_call("php app/console cache:clear --env=prod --no-debug", shell=True, cwd="php-symfony2")
subprocess.check_call("sudo chown -R www-data:www-data php-symfony2", shell=True)
subprocess.check_call(
"sudo php-fpm --fpm-config config/php-fpm.conf -g "
+ home
+ "/FrameworkBenchmarks/php-symfony2/deploy/php-fpm.pid",
shell=True,
)
subprocess.check_call(
"sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/php-symfony2/deploy/nginx.conf",
shell=True,
)
return 0
except subprocess.CalledProcessError:
return 1
示例2: start
def start(args, logfile, errfile):
setup_util.replace_text("hhvm/once.php.inc", "host=localhost;", "host=" + args.database_host + ";")
setup_util.replace_text(
"hhvm/deploy/config.hdf",
"SourceRoot = .*\/FrameworkBenchmarks",
"SourceRoot = " + home + "/FrameworkBenchmarks",
)
setup_util.replace_text(
"hhvm/deploy/config.hdf", "Path = .*\/.hhvm.hhbc", "Path = " + home + "/FrameworkBenchmarks/hhvm/.hhvm.bbhc"
)
setup_util.replace_text(
"hhvm/deploy/config.hdf", "PidFile = .*\/hhvm.pid", "PidFile = " + home + "/FrameworkBenchmarks/hhvm/hhvm.pid"
)
setup_util.replace_text(
"hhvm/deploy/config.hdf", "File = .*\/error.log", "File = " + home + "/FrameworkBenchmarks/hhvm/error.log"
)
try:
if os.name == "nt":
# Not supported !
return 0
subprocess.check_call(
"hhvm --config " + home + "/FrameworkBenchmarks/hhvm/deploy/config.hdf -m daemon",
shell=True,
stderr=errfile,
stdout=logfile,
)
return 0
except subprocess.CalledProcessError:
return 1
示例3: start
def start(args, logfile, errfile, cwd="wt"):
setup_util.replace_text("wt/benchmark.cpp", "INSERT_DB_HOST_HERE", args.database_host)
subprocess.check_call(
"g++ -O3 -DNDEBUG -std=c++0x -L/usr/local/lib -I/usr/local/include -o benchmark.wt benchmark.cpp -lwt -lwthttp -lwtdbo -lwtdbomysql -lboost_thread",
shell=True,
cwd=cwd,
stderr=errfile,
stdout=logfile,
)
os.environ["LD_LIBRARY_PATH"] = "/usr/local/lib:" + os.environ.get("LD_LIBRARY_PATH", ".")
subprocess.Popen(
[
"./benchmark.wt",
"-c",
"wt_config.xml",
"-t",
str(args.max_threads * 4),
"--docroot",
".",
"--http-address",
"0.0.0.0",
"--http-port",
"8080",
"--accesslog=-",
"--no-compression",
],
cwd=cwd,
stderr=errfile,
stdout=logfile,
)
return 0
示例4: start
def start(args):
setup_util.replace_text(cwd + "/server.py", "localhost", args.database_host)
subprocess.Popen(
"python %s/FrameworkBenchmarks/tornado/server.py --port=8080 --logging=error" % home, shell=True, cwd=cwd
)
return 0
示例5: start
def start(args, logfile, errfile):
setup_util.replace_text("vertx/app.js", "host: '.*'", "host: '" + args.database_host + "'")
try:
subprocess.Popen("vertx run app.js", shell=True, cwd="vertx", stderr=errfile, stdout=logfile)
return 0
except subprocess.CalledProcessError:
return 1
示例6: start
def start(args, logfile, errfile):
setup_util.replace_text("lapis/config.lua", "DBHOSTNAME", args.database_host)
setup_util.replace_text("lapis/nginx.conf", "DBHOSTNAME", args.database_host)
#subprocess.Popen('/usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
subprocess.Popen('lapis server production', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
return 0
示例7: start
def start(args, logfile, errfile):
setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",")
os.putenv("ONION_LOG","noinfo")
subprocess.call("rm *.o", cwd="onion", shell=True, stderr=errfile, stdout=logfile)
subprocess.call("cp -R installs/onion/* onion/onion", shell=True, stderr=errfile, stdout=logfile)
subprocess.Popen("make && ./hello", shell=True, cwd="onion", stderr=errfile, stdout=logfile)
return 0
示例8: start
def start(args):
setup_util.replace_text("lift-stateless/src/main/scala/Main.scala", "> \".*:3306", "> \"" + args.database_host + ":3306")
subprocess.check_call("../sbt/sbt update assembly", shell=True, cwd="lift-stateless")
subprocess.Popen("./run", shell=True, cwd="lift-stateless")
return 0
示例9: start
def start(args):
setup_util.replace_text("ringojs/ringo-main.js", "dbHost = '.*';", "dbHost = '" + args.database_host + "';")
try:
subprocess.Popen("ringo --production ringo-main.js", shell=True, cwd="ringojs")
return 0
except subprocess.CalledProcessError:
return 1
示例10: start
def start(args):
setup_util.replace_text("vertx/App.groovy", "host: '.*'", "host: '" + args.database_host + "'")
try:
subprocess.Popen("vertx run WebServer.java", shell=True, cwd="vertx")
return 0
except subprocess.CalledProcessError:
return 1
示例11: start
def start(args):
setup_util.replace_text("snap/bench/cfg/db.cfg", "host=\".*\"", "host=\"" + args.database_host + "\"")
subprocess.check_call("cabal configure", shell=True, cwd="snap/bench")
subprocess.check_call("cabal build", shell=True, cwd="snap/bench")
t = str(args.max_threads)
subprocess.Popen("dist/build/snap-bench/snap-bench +RTS -A" + t + "M -N" + t + " > /dev/null", shell=True, cwd="snap/bench")
return 0
示例12: start
def start(args):
setup_util.replace_text("snap/bench/cfg/db.cfg", "host=\".*\"", "host=\"" + args.database_host + "\"")
subprocess.check_call("cabal install HDBC HDBC-mysql MonadCatchIO-transformers configurator json snap-core snap-server resource-pool", shell=True)
subprocess.check_call("cabal configure", shell=True, cwd="snap/bench")
subprocess.check_call("cabal install", shell=True, cwd="snap/bench")
subprocess.Popen("dist/build/snap-bench/snap-bench +RTS -N" + str(args.max_threads) + " > /dev/null", shell=True, cwd="snap/bench")
return 0
示例13: start
def start(args):
setup_util.replace_text(
cwd + "/server.py", "localhost", args.database_host)
subprocess.Popen(
python + " server.py --port=8080 --logging=error",
shell=True, cwd=cwd)
return 0
示例14: start
def start(args, logfile, errfile):
setup_util.replace_text("unfiltered/src/main/resources/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
setup_util.replace_text("unfiltered/src/main/resources/application.conf", "maxThreads = \\d+", "maxThreads = " + str(args.max_threads))
subprocess.check_call("../sbt/sbt assembly", shell=True, cwd="unfiltered", stderr=errfile, stdout=logfile)
subprocess.Popen("java -jar bench-assembly-1.0.0.jar", shell=True, cwd="unfiltered/target/scala-2.10", stderr=errfile, stdout=logfile)
return 0
示例15: start
def start(args, logfile, errfile):
setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",")
subprocess.call("rm -f *.o", cwd="onion", shell=True, stderr=errfile, stdout=logfile)
subprocess.call("cp -R $IROOT/onion/ onion/onion", shell=True, stderr=errfile, stdout=logfile)
subprocess.call("rm CMakeCache.txt", shell=True, cwd="onion/onion/build", stderr=errfile, stdout=logfile)
subprocess.Popen("make && ./hello", shell=True, cwd="onion", stderr=errfile, stdout=logfile)
return 0