コード例 #1
0
ファイル: python.py プロジェクト: 3quarterstack/fabtools
def package(pkg_name, url=None, pip_cmd='pip', python_cmd='python', **kwargs):
    """
    Require a Python package.

    If the package is not installed, it will be installed
    using the `pip installer`_.

    Package names are case insensitive.

    ::

        from fabtools.python import virtualenv
        from fabtools import require

        # Install package system-wide
        require.python.package('foo', use_sudo=True)

        # Install package in an existing virtual environment
        with virtualenv('/path/to/venv'):
            require.python.package('bar')

    .. _pip installer: http://www.pip-installer.org/
    """
    pip(MIN_PIP_VERSION, python_cmd=python_cmd)
    if not is_installed(pkg_name, pip_cmd=pip_cmd):
        install(url or pkg_name, pip_cmd=pip_cmd, **kwargs)
コード例 #2
0
ファイル: python.py プロジェクト: ajeebkp23/fabtools
def packages(pkg_list, pip_cmd='pip', python_cmd='python',
             allow_external=None, allow_unverified=None, **kwargs):
    """
    Require several Python packages.

    Package names are case insensitive.

    Starting with version 1.5, pip no longer scrapes insecure external
    urls by default and no longer installs externally hosted files by
    default. Use ``allow_external=['foo', 'bar']`` or
    ``allow_unverified=['bar', 'baz']`` to change these behaviours
    for specific packages.
    """
    if allow_external is None:
        allow_external = []

    if allow_unverified is None:
        allow_unverified = []

    pip(MIN_PIP_VERSION, python_cmd=python_cmd)

    pkg_list = [pkg for pkg in pkg_list if not is_installed(pkg, pip_cmd=pip_cmd)]
    if pkg_list:
        install(pkg_list,
                pip_cmd=pip_cmd,
                allow_external=allow_external,
                allow_unverified=allow_unverified,
                **kwargs)
コード例 #3
0
def setup_gunicorn():
    print_title('Installing Gunicorn')
    with virtualenv(Settings.DIR_VENV):
        install('gunicorn', use_sudo=False)

    gunicorn_conf = '''[Unit]
        Description=gunicorn daemon
        After=network.target

        [Service]
        User={USER}
        Group={GRP}
        WorkingDirectory={PATH}
        Restart=always
        ExecStart={VIRTUALENV_PATH}/bin/gunicorn --workers 3 --bind unix:{SOCKET_FILES_PATH}{PROJECT_NAME}.sock {APP_ENTRY_POINT}

        [Install]
        WantedBy=multi-user.target
        '''.format(
            APP_NAME=Settings.ROOT_NAME,
            PROJECT_NAME=Settings.ROOT_NAME,
            PATH=Settings.DIR_CODE,
            USER=env.user,
            GRP=Settings.DEPLOY_GRP,
            VIRTUALENV_PATH=Settings.DIR_VENV,
            SOCKET_FILES_PATH=Settings.DIR_SOCK,
            APP_ENTRY_POINT=Settings.APP_ENTRY_POINT
        )
    
    gunicorn_service = "/etc/systemd/system/gunicorn.service"
    files.append(gunicorn_service, gunicorn_conf, use_sudo=True)
    sudo('systemctl enable gunicorn')
    sudo('systemctl start gunicorn')
コード例 #4
0
def setup_rfm69serial_service():
    print_title('Installing RFM69 Serial Service')
    with virtualenv(Settings.DIR_VENV):
        install('pyserial', use_sudo=False)

    conf = '''[Unit]
        Description=Serial daemon
        After=network.target

        [Service]
        User={USER}
        Group={GRP}
        WorkingDirectory={PATH}
        Restart=always
        ExecStart={VIRTUALENV_PATH}bin/python rfmSerial.py

        [Install]
        WantedBy=multi-user.target
        '''.format(
            PATH=Settings.DIR_CODE,
            USER=env.user,
            GRP=Settings.DEPLOY_GRP,
            VIRTUALENV_PATH=Settings.DIR_VENV
        )
    service = "/etc/systemd/system/rfmserial.service"
    files.append(service, conf, use_sudo=True)
    sudo('systemctl enable rfmserial')
    sudo('systemctl start rfmserial')
コード例 #5
0
def packages(pkg_list,
             pip_cmd='pip',
             python_cmd='python',
             allow_external=None,
             allow_unverified=None,
             **kwargs):
    """
    Require several Python packages.

    Package names are case insensitive.

    Starting with version 1.5, pip no longer scrapes insecure external
    urls by default and no longer installs externally hosted files by
    default. Use ``allow_external=['foo', 'bar']`` or
    ``allow_unverified=['bar', 'baz']`` to change these behaviours
    for specific packages.
    """
    if allow_external is None:
        allow_external = []

    if allow_unverified is None:
        allow_unverified = []

    pip(MIN_PIP_VERSION, python_cmd=python_cmd)

    pkg_list = [
        pkg for pkg in pkg_list if not is_installed(pkg, pip_cmd=pip_cmd)
    ]
    if pkg_list:
        install(pkg_list,
                pip_cmd=pip_cmd,
                allow_external=allow_external,
                allow_unverified=allow_unverified,
                **kwargs)
コード例 #6
0
def setup():
    require.git.working_copy(CIDADEILUMINADA_REPO_PATH, path=CIDADEILUMINADA_WORK_PATH, update=True)
    with cd(CIDADEILUMINADA_WORK_PATH):
        require.python.virtualenv(CIDADEILUMINADA_WORK_PATH)
        with virtualenv(CIDADEILUMINADA_WORK_PATH):
            python.install('uwsgi')
    create_settings_local()
コード例 #7
0
ファイル: python.py プロジェクト: simonluijk/fabtools
def package(pkg_name, url=None, pip_cmd='pip', python_cmd='python', **kwargs):
    """
    Require a Python package.

    If the package is not installed, it will be installed
    using the `pip installer`_.

    Package names are case insensitive.

    ::

        from fabtools.python import virtualenv
        from fabtools import require

        # Install package system-wide
        require.python.package('foo', use_sudo=True)

        # Install package in an existing virtual environment
        with virtualenv('/path/to/venv'):
            require.python.package('bar')

    .. _pip installer: http://www.pip-installer.org/
    """
    pip(MIN_PIP_VERSION, python_cmd=python_cmd)
    if not is_installed(pkg_name, pip_cmd=pip_cmd):
        install(url or pkg_name, pip_cmd=pip_cmd, **kwargs)
コード例 #8
0
def packages(pkg_list, **kwargs):
    """
    Require several Python packages.
    """
    pip(DEFAULT_PIP_VERSION)
    pkg_list = [pkg for pkg in pkg_list if not is_installed(pkg)]
    if pkg_list:
        install(pkg_list, **kwargs)
コード例 #9
0
ファイル: python.py プロジェクト: manojlds/fabtools
def packages(pkg_list, **kwargs):
    """
    Require several Python packages.
    """
    pip(DEFAULT_PIP_VERSION)
    pkg_list = [pkg for pkg in pkg_list if not is_installed(pkg)]
    if pkg_list:
        install(pkg_list, **kwargs)
コード例 #10
0
def setup():
    require.git.working_copy(CIDADEILUMINADA_REPO_PATH,
                             path=CIDADEILUMINADA_WORK_PATH,
                             update=True)
    with cd(CIDADEILUMINADA_WORK_PATH):
        require.python.virtualenv(CIDADEILUMINADA_WORK_PATH)
        with virtualenv(CIDADEILUMINADA_WORK_PATH):
            python.install('uwsgi')
    create_settings_local()
コード例 #11
0
ファイル: python.py プロジェクト: 3quarterstack/fabtools
def packages(pkg_list, pip_cmd='pip', python_cmd='python', **kwargs):
    """
    Require several Python packages.

    Package names are case insensitive.
    """
    pip(MIN_PIP_VERSION, python_cmd=python_cmd)
    pkg_list = [pkg for pkg in pkg_list if not is_installed(pkg, pip_cmd=pip_cmd)]
    if pkg_list:
        install(pkg_list, pip_cmd=pip_cmd, **kwargs)
コード例 #12
0
def setup():
    require.git.working_copy('[email protected]:ArthurPBressan/hotsite-sa-bilac-2015.git',
                             path=HOTSITE_WORK_PATH, update=True)
    with cd(HOTSITE_WORK_PATH):
        require.files.directories(['instance', 'tmp'], use_sudo=True)
        require.python.virtualenv(HOTSITE_WORK_PATH)
        with virtualenv(HOTSITE_WORK_PATH):
            python.install('uwsgi')
    deploy()
    with cd(HOTSITE_WORK_PATH), virtualenv(HOTSITE_WORK_PATH):
        sudo('uwsgi --socket :8080 --module="hotsite:create_app()" --touch-reload="/root/uwsgi_file" &')
コード例 #13
0
ファイル: python.py プロジェクト: simonluijk/fabtools
def packages(pkg_list, pip_cmd='pip', python_cmd='python', **kwargs):
    """
    Require several Python packages.

    Package names are case insensitive.
    """
    pip(MIN_PIP_VERSION, python_cmd=python_cmd)
    pkg_list = [
        pkg for pkg in pkg_list if not is_installed(pkg, pip_cmd=pip_cmd)
    ]
    if pkg_list:
        install(pkg_list, pip_cmd=pip_cmd, **kwargs)
コード例 #14
0
def setup():
    require.git.working_copy('[email protected]:HardDiskD/TCMCidadeIluminada.git',
                             path=CIDADEILUMINADA_WORK_PATH,
                             update=True)
    with cd(CIDADEILUMINADA_WORK_PATH):
        require.files.directories(['instance', 'tmp'], use_sudo=True)
        require.python.virtualenv(CIDADEILUMINADA_WORK_PATH)
        with virtualenv(CIDADEILUMINADA_WORK_PATH):
            python.install('uwsgi')
    deploy()
    with cd(CIDADEILUMINADA_WORK_PATH), virtualenv(CIDADEILUMINADA_WORK_PATH):
        sudo('python manage.py ci criar_usuario admin 123456')
        sudo(
            'uwsgi --socket :8080 --module="cidadeiluminada:create_app()" --touch-reload="/root/uwsgi_file"'
        )
コード例 #15
0
def deploy():
    require("install_location")
    sudo("mkdir -p %(install_location)s" % env)
    if not is_pip_installed():
        install_pip()
    install("virtualenv", use_sudo=True)
    put(join_local("pip-requirements.txt"), "/tmp/pip-requirements.txt")
    with _virtualenv():
        install_requirements("/tmp/pip-requirements.txt", use_sudo=True)
        sudo("pip install -e git+https://github.com/oliverdrake/rpitempcontroller.git#egg=tempcontrol")
    put("tempcontroller-config.default", env.config_file, use_sudo=True,
        mirror_local_mode=True)
    with settings(python_bin_dir=os.path.join(_virtualenv_location(), "bin")):
        upload_template("init-script.in", env.init_script, mode=0754,
                        use_jinja=True, context=env, use_sudo=True,
                        backup=False)
    sudo("chown root:root %(init_script)s" % env)
コード例 #16
0
ファイル: python.py プロジェクト: ponty/mykitchen2
def sphinx():
    # they are not available in older releases
    require_deb_packages(
        '''
                    python-blockdiag
                    python-seqdiag
                    python-sphinxcontrib.blockdiag
                    python-sphinxcontrib.seqdiag
                    python-tablib
                    ''', error_if_not_exists=False
    )

    require_deb_packages(
        '''
gtkwave
mercurial
python-sphinx
scrot
texlive-fonts-recommended
texlive-latex-extra
                    '''
    )

    require_python_packages(
        '''
PyVirtualDisplay
pyscreenshot

sphinxcontrib-programoutput
sphinxcontrib-programscreenshot
sphinxcontrib-gtkwave
sphinxcontrib-eagle
eagexp
discogui
PyMouse
                    ''')

    # sphinx-contrib
    if not is_installed('autorun'):
        if is_dir('/tmp/sphinx-contrib'):
            run('rm -rf /tmp/sphinx-contrib')
        with cd('/tmp'):
            run('hg clone https://bitbucket.org/birkenfeld/sphinx-contrib')
        install('/tmp/sphinx-contrib/autorun', use_sudo=True)
コード例 #17
0
def package(pkg_name,
            url=None,
            pip_cmd='pip',
            python_cmd='python',
            allow_external=False,
            allow_unverified=False,
            **kwargs):
    """
    Require a Python package.

    If the package is not installed, it will be installed
    using the `pip installer`_.

    Package names are case insensitive.

    Starting with version 1.5, pip no longer scrapes insecure external
    urls by default and no longer installs externally hosted files by
    default. Use ``allow_external=True`` or ``allow_unverified=True``
    to change these behaviours.

    ::

        from fabtools.python import virtualenv
        from fabtools import require

        # Install package system-wide (not recommended)
        require.python.package('foo', use_sudo=True)

        # Install package in an existing virtual environment
        with virtualenv('/path/to/venv'):
            require.python.package('bar')

    .. _pip installer: http://www.pip-installer.org/
    """
    pip(MIN_PIP_VERSION, python_cmd=python_cmd)
    if not is_installed(pkg_name, python_cmd=python_cmd, pip_cmd=pip_cmd):
        install(url or pkg_name,
                python_cmd=python_cmd,
                pip_cmd=pip_cmd,
                allow_external=[url or pkg_name] if allow_external else [],
                allow_unverified=[url or pkg_name] if allow_unverified else [],
                **kwargs)
コード例 #18
0
ファイル: python.py プロジェクト: sociateru/fabtools
def package(pkg_name, url=None, pip_cmd='pip', python_cmd='python',
            allow_external=False, allow_unverified=False, trusted_hosts=None,
            **kwargs):
    """
    Require a Python package.

    If the package is not installed, it will be installed
    using the `pip installer`_.

    Package names are case insensitive.

    Starting with version 1.5, pip no longer scrapes insecure external
    urls by default and no longer installs externally hosted files by
    default. Use ``allow_external=True`` or ``allow_unverified=True``
    to change these behaviours.

    ::

        from fabtools.python import virtualenv
        from fabtools import require

        # Install package system-wide (not recommended)
        require.python.package('foo', use_sudo=True)

        # Install package in an existing virtual environment
        with virtualenv('/path/to/venv'):
            require.python.package('bar')

    .. _pip installer: http://www.pip-installer.org/
    """
    pip(MIN_PIP_VERSION, python_cmd=python_cmd)
    if not is_installed(pkg_name, pip_cmd=pip_cmd):
        install(url or pkg_name,
                pip_cmd=pip_cmd,
                allow_external=[url or pkg_name] if allow_external else [],
                allow_unverified=[url or pkg_name] if allow_unverified else [],
                trusted_hosts=trusted_hosts,
                **kwargs)
コード例 #19
0
ファイル: fabfile.py プロジェクト: DopeChicCity/newebe
def update_source():
    """Simple git pull inside newebe directory"""

    python.install("git+git://github.com/gelnior/newebe.git")
コード例 #20
0
ファイル: fabfile.py プロジェクト: DopeChicCity/newebe
def setup_supervisord():
    """Install python daemon manager, supervisord"""

    python.install("meld3==0.6.9", use_sudo=True)
    require.deb.package("supervisor")
コード例 #21
0
ファイル: fabfile.py プロジェクト: HeartbliT/IReVeAI
def update_source():
    """Simple git pull inside newebe directory"""

    python.install("git+git://github.com/gelnior/newebe.git")
コード例 #22
0
ファイル: fabfile.py プロジェクト: HeartbliT/IReVeAI
def setup_supervisord():
    """Install python daemon manager, supervisord"""

    python.install("meld3==0.6.9", use_sudo=True)
    require.deb.package("supervisor")
コード例 #23
0
def create_venv():
    with cd(os.path(now,"current")):
        sudo("virtualenv router_log_parser_env")
        with virtualenv("router_log_parser_env"):
            install("pymongo")