diff -r fb621e89f9f1 -r 800c48d0e3c1 sbin/sync/fabfile.py --- a/sbin/sync/fabfile.py Thu Nov 29 17:20:45 2012 +0100 +++ b/sbin/sync/fabfile.py Thu Nov 29 18:23:51 2012 +0100 @@ -21,10 +21,10 @@ if os.path.isdir(path): shutil.rmtree(path, ignore_errors=True) -def do_export_version(path, version, *export_keys): - print("Export version %s with keys %s" % (str(version), repr(export_keys))) +def do_export_version(path, **export_keys): + print("Export version %s " % (repr(export_keys))) - for export_key in export_keys: + for export_key, version in export_keys.items(): export_path = os.path.join(path,export_key) repo_url = env.repos[export_key] @@ -40,7 +40,7 @@ with lcd(clone_path): local("hg archive -r \'%s\' \"%s\"" % (str(version),export_path)) - print("Export version %s done"%str(version)) + print("Export version %s done"%repr(export_keys)) def get_remote_env(remotepath, remotevirtualenvpath, platform_web_module, settings_key): @@ -120,11 +120,13 @@ run("rm \"%s\"" % path) -def install_build(remotepath, remotevirtualenvpath): +def install_build(remotepath, remotevirtualenvpath, module_to_uninstall= None): print("Install build %s in %s" % (remotepath, remotevirtualenvpath)) activate_path = os.path.join(remotevirtualenvpath, "bin/activate") with prefix("source %s" % activate_path): + if module_to_uninstall: + run("pip uninstall %s" % module_to_uninstall) run("pip install \"%s\"" % remotepath) def collectstatic(remotepath, remotevirtualenvpath, platform_web_module): @@ -168,14 +170,14 @@ if not exists(remote_config_path, verbose=True): upload_template(template_path, remote_config_path, context=context) -def export_version(version, *args): - print("export version %s for %s" % (str(version), args)) +def export_version(**kwargs): + print("export version %s for %s" % (repr(kwargs))) - export_path = get_export_path(version) + export_path = get_export_path("_".join(["%s_%s" % (k,v) for k,v in kwargs.items()])) clean_export_folder(export_path) - do_export_version(export_path,version, *args) + do_export_version(export_path,**kwargs) return export_path @@ -203,14 +205,14 @@ build_src(src_path) (_,version_str) = get_src_version(src_path) build_path = os.path.join(src_path,"dist","ldt-%s.tar.gz" % version_str) - sync_install_build(build_path) + sync_install_build(build_path, 'ldt') -def sync_install_build(build_path): +def sync_install_build(build_path, module_to_uninstall=None): res_trans = None try: res_trans = sync_build(build_path) - install_build(res_trans[0], env.remote_path['virtualenv']) + install_build(res_trans[0], env.remote_path['virtualenv'], module_to_uninstall) finally: if res_trans: remove_build(res_trans[0]) @@ -248,7 +250,7 @@ @task def sync_web(version): print(green("sync web with version %s" % version)) - export_path = export_version(version, 'web') + export_path = export_version(web=version) export_path_full = os.path.join(export_path,'web') do_sync_web(version, export_path_full) create_config(export_path_full) @@ -258,7 +260,7 @@ @task def sync_ldt(version): print(green("sync ldt with version %s" % version)) - export_path = export_version(version, 'ldt') + export_path = export_version(ldt=version) export_path_full = os.path.join(export_path,'ldt') do_sync_ldt(version, export_path_full) clean_export_folder(export_path) @@ -267,7 +269,7 @@ @task def update_lib(version, package): print(green("update ldt with version %s" % version)) - export_path = export_version(version,'web') + export_path = export_version(web=version) export_path_full = os.path.join(export_path,'web') lib_path = os.path.join(export_path_full, "virtualenv", "res", "lib") @@ -283,9 +285,9 @@ relaunch_server() @task -def sync_platform(version): +def sync_platform(version_web, version_ldt): print(green("sync platform with version %s" % version)) - export_path = export_version(version, 'ldt', 'web') + export_path = export_version(ldt=version_ldt, web=version_web) export_path_ldt = os.path.join(export_path,'ldt') export_path_web = os.path.join(export_path,'web') do_sync_ldt(version, export_path_ldt) @@ -297,7 +299,7 @@ @task def create_virtualenv(version): print(green("create virtualenv with version %s" % version)) - export_path = export_version(version, 'web') + export_path = export_version(web=version) export_path_web = os.path.join(export_path,'web') venv_remote_export_path = "" try: