correct fabfile V00.01
authorymh <ymh.work@gmail.com>
Fri, 21 Sep 2012 11:13:11 +0900
changeset 17 f8c613e43ebd
parent 16 6118ebbcaaca
child 18 97aa4b45dadf
correct fabfile
sbin/sync/config.py.tmpl
sbin/sync/fabfile.py
--- a/sbin/sync/config.py.tmpl	Fri Sep 21 11:12:53 2012 +0900
+++ b/sbin/sync/config.py.tmpl	Fri Sep 21 11:13:11 2012 +0900
@@ -5,6 +5,11 @@
 env.web_group = '<web_user_group>'
 env.folders = ['log', 'static/media']
 
+env.local_folders = {
+    'web': 'ldt/web',
+    'virtualenv': 'virtualenv',
+}
+
 env.base_export_path = "<local path used to export hg version>"
 env.export_prefix = "hyperplateau"
 env.remote_web_path = "<path of website root folder on the server>"
--- a/sbin/sync/fabfile.py	Fri Sep 21 11:12:53 2012 +0900
+++ b/sbin/sync/fabfile.py	Fri Sep 21 11:13:11 2012 +0900
@@ -13,7 +13,7 @@
 
 def get_export_path(version):
     base_path = os.path.join(env.base_export_path,env.export_prefix).rstrip("/")
-    return os.path.expanduser(base_path) + "_%s/ldt" % (str(version))
+    return os.path.expanduser(base_path) + "_%s" % (str(version))
 
 def clean_export_folder(path):
     print("Removing %s" % path)
@@ -71,7 +71,7 @@
     print("Create config from %s" % (export_path,))
     remotepath = env.remote_web_path
     remote_config_path = os.path.join(remotepath, env.platform_web_module, "config.py")
-    template_path = os.path.join(export_path, "web", env.platform_web_module, "config.py.tmpl")
+    template_path = os.path.join(export_path, env.local_folders.get("web","web"), env.platform_web_module, "config.py.tmpl")
     
     context = {
      'base_dir': os.path.join(remotepath, env.platform_web_module).rstrip("/")+"/",
@@ -128,7 +128,7 @@
 
 def do_sync_web(version, export_path):
     print("do_sync_web with version %s and path %s" % (version,export_path))
-    web_path = os.path.join(export_path,"web/") 
+    web_path = os.path.join(export_path,env.local_folders.get("web","web").rstrip("/")+"/") 
     rsync_export(web_path, env.remote_web_path, env.web_rsync_filters)    
     
 def check_folder_access():
@@ -163,14 +163,14 @@
 def update_lib(version, package):
     print(green("update ldt with version %s" % version))
     export_path = export_version(version)
-    lib_path = os.path.join(export_path, "virtualenv", "res", "lib")
+    lib_path = os.path.join(export_path, env.local_folders.get("virtualenv","virtualenv"), "res", "lib")
     
     f, pathname, description = imp.find_module("patch", [lib_path])
     patch = imp.load_module("patch", f, pathname, description)
     f, pathname, description = imp.find_module("lib_create_env", [lib_path])
     lib_create_env = imp.load_module("lib_create_env", f, pathname, description)
     
-    package_path = os.path.join(export_path, "virtualenv", "res", "src", lib_create_env.URLS[package]['local'])
+    package_path = os.path.join(export_path, env.local_folders.get("virtualenv","virtualenv"), "res", "src", lib_create_env.URLS[package]['local'])
     
     sync_install_build(package_path)
     clean_export_folder(export_path)
@@ -183,7 +183,7 @@
     export_path = export_version(version)
     venv_remote_export_path = ""
     try:
-        virtualenv_path = os.path.join(export_path, "virtualenv")
+        virtualenv_path = os.path.join(export_path, env.local_folders.get("virtualenv","virtualenv"))
     
         venv_remote_export_path = os.path.join(env.remote_venv_export_path, env.export_prefix, version,"virtualenv")
         rsync_export(virtualenv_path, venv_remote_export_path, env.venv_rsync_filters)