sbin/sync/fabfile.py
changeset 641 7d5640606813
parent 632 e85856bfd59b
child 642 b419e891b0bd
equal deleted inserted replaced
640:383be02a85eb 641:7d5640606813
    97         run("pip install \"%s\"" % remotepath)
    97         run("pip install \"%s\"" % remotepath)
    98 
    98 
    99 def collectstatic(remotepath, remotevirtualenvpath):
    99 def collectstatic(remotepath, remotevirtualenvpath):
   100     print("Collect static in %s with %s" % (remotepath, remotevirtualenvpath))
   100     print("Collect static in %s with %s" % (remotepath, remotevirtualenvpath))
   101     activate_path = os.path.join(remotevirtualenvpath, "bin/activate")
   101     activate_path = os.path.join(remotevirtualenvpath, "bin/activate")
   102     with prefix("source %s" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(os.path.join(remotepath, env.platform_web_module)):
   102     with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(os.path.join(remotepath, env.platform_web_module)):
   103         run("python manage.py collectstatic --noinput")
   103         run("python manage.py collectstatic --noinput")
   104         
   104         
   105         
   105         
   106 
   106 
   107 def export_version(version):
   107 def export_version(version):
   114     
   114     
   115     return export_path
   115     return export_path
   116 
   116 
   117 def do_create_virtualenv(remote_venv_export_path, remotevirtualenvpath):
   117 def do_create_virtualenv(remote_venv_export_path, remotevirtualenvpath):
   118     print("Create virtualenv export_path : %s - remote venvpath : %s" % (remote_venv_export_path, remotevirtualenvpath))
   118     print("Create virtualenv export_path : %s - remote venvpath : %s" % (remote_venv_export_path, remotevirtualenvpath))
       
   119     activate_path = os.path.join(remotevirtualenvpath, "bin/activate")
   119     if "remote_baseline_venv" in env and env.remote_baseline_venv:
   120     if "remote_baseline_venv" in env and env.remote_baseline_venv:
   120         prefix_str = os.path.join(env.remote_baseline_venv, "bin/activate")
   121         prefix_str = os.path.join(env.remote_baseline_venv, "bin/activate")
   121     else:
   122     else:
   122         prefix_str = "echo"
   123         prefix_str = "echo"
   123     run("mkdir -p \"%s\"" % remotevirtualenvpath)
   124     run("mkdir -p \"%s\"" % remotevirtualenvpath)
   124     with prefix(prefix_str), cd(os.path.join(remote_venv_export_path,"virtualenv","web")):
   125     with prefix(prefix_str), cd(os.path.join(remote_venv_export_path,"virtualenv","web")):
   125         run("python create_python_env.py")
   126         run("python create_python_env.py")
   126         run("python project-boot.py --unzip-setuptools --no-site-packages --clear --type-install=local \"%s\"" % remotevirtualenvpath)        
   127         run("python project-boot.py --unzip-setuptools --no-site-packages --clear --type-install=local \"%s\"" % remotevirtualenvpath)
       
   128     with prefix("source \"%s\"" % activate_path):
       
   129         run("pip install -r \"%s\"" % os.path.join(remote_venv_export_path,"virtualenv","web","res","srvr_requirements.txt"))
   127 
   130 
   128 def do_sync_ldt(version, export_path):
   131 def do_sync_ldt(version, export_path):
   129     print("do_sync_ldt with version %s and path %s" % (version,export_path))
   132     print("do_sync_ldt with version %s and path %s" % (version,export_path))
   130     src_path = export_path + "/src/ldt"
   133     src_path = export_path + "/src/ldt"
   131     build_src(src_path)
   134     build_src(src_path)