From 16377e0a950c8c55f1f50b07076d824eb2e7342e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sat, 28 May 2016 01:39:59 +0800 Subject: [PATCH] making botan-start runnable alone --- botan-start.py | 18 +++++++++--------- botanjs/compressor/closure.py | 3 ++- botanjs/compressor/yui.py | 3 ++- settings.ini | 3 +++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/botan-start.py b/botan-start.py index bd0c3e7..81708f3 100755 --- a/botan-start.py +++ b/botan-start.py @@ -1,25 +1,25 @@ -#!/usr/bin/env python3 +#!env/bin/python -import os, pwd, grp +import os, sys from botanjs.config import Config as config, DEBUG - -import shutil +from subprocess import Popen +from botanjs.service.webapi import WebAPI SiteRoot = os.path.abspath( "." ) +# Setting the SiteRoot for config config["Paths"]["SiteRoot"] = SiteRoot; # Create the lock folder for celery -lockDir = SiteRoot + "env/var/run/celery" +lockDir = os.path.join( SiteRoot, "env", "var", "run" "celery" ) os.makedirs( lockDir, exist_ok=True ) -import sys -from subprocess import Popen - sys.path.append( os.path.abspath( "." ) ) -from botanjs.service.webapi import WebAPI +RUNTIME_ENV = os.path.abspath( os.path.join( "env", "bin" ) ) +if RUNTIME_ENV not in os.environ[ "PATH" ]: + os.environ[ "PATH" ] = RUNTIME_ENV + os.pathsep + os.environ[ "PATH" ] if __name__ == "__main__": diff --git a/botanjs/compressor/closure.py b/botanjs/compressor/closure.py index a36d87e..74468e7 100755 --- a/botanjs/compressor/closure.py +++ b/botanjs/compressor/closure.py @@ -2,8 +2,9 @@ import os from tempfile import NamedTemporaryFile +from botanjs.config import Config as config -COMPILER = "/opt/utils/closure.jar" +COMPILER = config[ "BotanJS" ][ "ClosureCompiler" ] if not os.path.isfile( COMPILER ): raise Exception( "Compiler not found" ) diff --git a/botanjs/compressor/yui.py b/botanjs/compressor/yui.py index 99341d6..b4dd0ff 100755 --- a/botanjs/compressor/yui.py +++ b/botanjs/compressor/yui.py @@ -1,8 +1,9 @@ #!/usr/bin/env python3 import os +from botanjs.config import Config as config -COMPILER = "/opt/utils/yuicompressor.jar" +COMPILER = config[ "BotanJS" ][ "YuiCompressor" ] if not os.path.isfile( COMPILER ): raise Exception( "Compiler not found" ) diff --git a/settings.ini b/settings.ini index 559e1da..1568871 100644 --- a/settings.ini +++ b/settings.ini @@ -11,3 +11,6 @@ SrcDir = ${Paths:Runtime}/botanjs/src CeleryBroker = redis://:${REDIS_PASS}@123.123.123.123:1234/9 REDIS_PASS = PASSWORD_FOR_REDIS_DB + +ClosureCompiler = /opt/utils/closure.jar +YuiCompressor = /opt/utils/yuicompressor.jar