예제 #1
0
파일: managers.py 프로젝트: openxe/bount
    def init(self, delete_if_exists, python_path=""):
        if self.use_virtualenv:
            virtualenv_full_path = path(self.virtualenv_path).joinpath(self.virtualenv_name)
            if cuisine.dir_exists(virtualenv_full_path) and delete_if_exists:
                dir_delete(virtualenv_full_path)

            with cuisine_sudo():
                pip_install(['virtualenv'])

            with cuisine_sudo():
                dir_ensure(self.virtualenv_path, recursive=True, mode=777)
                dir_attribs(self.virtualenv_path, mode=777, recursive=True)

            # make lib synlinks to install PIL correctly
            with cuisine_sudo():
                if not file_exists("/usr/lib/libfreetype.so"):
                    run("ln -sf /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/")

                if not file_exists("/usr/lib/libz.so"):
                    run("ln -sf /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/")

                if not file_exists("/usr/lib/libjpeg.so"):
                    run("ln -sf /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/")

            with cd(self.virtualenv_path):
                run('VIRTUALENV_EXTRA_SEARCH_DIR="%s" && virtualenv %s' % (python_path, self.virtualenv_name))
예제 #2
0
    def media_restore_local_latest(self):
        dump_basename = self.latest_media_dump_basename()
        dump_local_path = self.local_media_dump_dir.joinpath(dump_basename)

        dir_delete(self.local_media_root)
        dir_ensure(self.local_media_root)

        with cd(self.local_media_root):
            run("tar -xvzf %s" % dump_local_path)
예제 #3
0
파일: managers.py 프로젝트: RuuPiE/bount
    def init(self, delete_if_exists, python_path=""):
        if self.use_virtualenv:
            virtualenv_full_path = path(self.virtualenv_path).joinpath(self.virtualenv_name)
            if cuisine.dir_exists(virtualenv_full_path) and delete_if_exists:
                dir_delete(virtualenv_full_path)

            with cuisine_sudo():
                pip_install(['virtualenv'])

            with cuisine_sudo():
                dir_ensure(self.virtualenv_path, recursive=True, mode=777)
                dir_attribs(self.virtualenv_path, mode=777, recursive=True)

            with cd(self.virtualenv_path):
                run('VIRTUALENV_EXTRA_SEARCH_DIR="%s" && virtualenv %s' % (python_path, self.virtualenv_name))
예제 #4
0
파일: managers.py 프로젝트: mturilin/bount
    def reset_project_dir(self):
        home_dir = remote_home()
        site_path_basename = path(self.remote_site_path).name
        with cuisine_sudo():
            cuisine.dir_ensure(self.remote_site_path, recursive=True, mode="777")
            cuisine.dir_ensure("%s/tmp" % home_dir, mode="777")
            dir_delete("%(home_dir)s/tmp/%(site_path_basename)s" % locals())
            cuisine.run("mv %(site_dir)s %(home_dir)s/tmp" % {"site_dir": self.remote_site_path, "home_dir": home_dir})

            clear_dir(self.remote_project_path)

            # restore site dir
            cuisine.run(
                "mv %(home_dir)s/tmp/%(site_dir_basename)s %(proj_path)s"
                % {"site_dir_basename": site_path_basename, "proj_path": self.remote_project_path, "home_dir": home_dir}
            )
예제 #5
0
파일: managers.py 프로젝트: RuuPiE/bount
    def clear_remote_project_path_save_site(self):
        home_dir = remote_home()
        site_path_basename = path(self.remote_site_path).name
        with cuisine_sudo():
            cuisine.dir_ensure(self.remote_site_path, recursive=True, mode='777')
            cuisine.dir_ensure("%s/tmp" % home_dir, mode='777')
            dir_delete("%(home_dir)s/tmp/%(site_path_basename)s" % locals())
            cuisine.run('mv %(site_dir)s %(home_dir)s/tmp' % {'site_dir': self.remote_site_path, 'home_dir': home_dir})

            clear_dir(self.remote_project_path)


            #restore site dir
            cuisine.run('mv %(home_dir)s/tmp/%(site_dir_basename)s %(proj_path)s' % {
                'site_dir_basename': site_path_basename,
                'proj_path': self.remote_project_path,
                'home_dir': home_dir
            })