From 87a756c5910b39b9a7035c2d7ff769faff24a4e7 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 2 Oct 2015 13:08:56 +0200 Subject: [PATCH] dnet-openaire/webservices.yml: do not use virtualenv, it does not work when libxml2 is required. dnet-openaire/roles/dli_portal/tasks/main.yml: Install the python portal. --- python-virtualenv/defaults/main.yml | 11 +++++---- python-virtualenv/defaults/main.yml~ | 0 python-virtualenv/tasks/main.yml | 35 ++++++++++++++++++++++++++++ python-virtualenv/tasks/main.yml~ | 0 4 files changed, 42 insertions(+), 4 deletions(-) delete mode 100644 python-virtualenv/defaults/main.yml~ delete mode 100644 python-virtualenv/tasks/main.yml~ diff --git a/python-virtualenv/defaults/main.yml b/python-virtualenv/defaults/main.yml index 6a991a3..7481390 100644 --- a/python-virtualenv/defaults/main.yml +++ b/python-virtualenv/defaults/main.yml @@ -1,11 +1,14 @@ --- -py_virtenv_install: True py_virtenv_pkgs_state: installed +py_virtenv_site: False py_virtenv_pkgs: - python-pip - python-virtualenv -py_virtenv_pip_pkgs: +# py_virtenv_pip_pkgs: +# - pip_pkg_1 +# - pip_pkg_2 -py_virtenv_env_path: - - /tmp +# py_virtenv_pip_requirements: "/tmp/pippo/requirements.txt" + +py_virtenv_env_base_dir: "/tmp/pippo" diff --git a/python-virtualenv/defaults/main.yml~ b/python-virtualenv/defaults/main.yml~ deleted file mode 100644 index e69de29..0000000 diff --git a/python-virtualenv/tasks/main.yml b/python-virtualenv/tasks/main.yml index 3ebf38e..efc6bba 100644 --- a/python-virtualenv/tasks/main.yml +++ b/python-virtualenv/tasks/main.yml @@ -3,3 +3,38 @@ apt: name={{ item }} state={{ py_virtenv_pkgs_state }} with_items: py_virtenv_pkgs tags: [ "python", "py_virtenv" ] + +- name: Create the virtenv environments. + command: virtualenv {{ py_virtenv_env_base_dir }} + tags: [ "python", "py_virtenv" ] + +- name: Install a list of pip packages inside the virtualenv, inherit the global site-packages + pip: name={{ item }} virtualenv={{ py_virtenv_env_base_dir }} virtualenv_site_packages=yes + with_items: py_virtenv_pip_pkgs + when: + - py_virtenv_pip_pkgs is defined + - py_virtenv_site + tags: [ "python", "py_virtenv" ] + +- name: Install a list of pip packages inside the virtualenv + pip: name={{ item }} virtualenv={{ py_virtenv_env_base_dir }} + with_items: py_virtenv_pip_pkgs + when: + - py_virtenv_pip_pkgs is defined + - not py_virtenv_site + tags: [ "python", "py_virtenv" ] + +- name: Install a list of pip packages inside the virtualenv from a requirements.txt file, inherit the global site-packages + pip: requirements={{ py_virtenv_pip_requirements }} virtualenv={{ py_virtenv_env_base_dir }} virtualenv_site_packages=yes + when: + - py_virtenv_pip_requirements is defined + - py_virtenv_site + tags: [ "python", "py_virtenv" ] + +- name: Install a list of pip packages inside the virtualenv from a requirements.txt file + pip: requirements={{ py_virtenv_pip_requirements }} virtualenv={{ py_virtenv_env_base_dir }} + when: + - py_virtenv_pip_requirements is defined + - not py_virtenv_site + tags: [ "python", "py_virtenv" ] + diff --git a/python-virtualenv/tasks/main.yml~ b/python-virtualenv/tasks/main.yml~ deleted file mode 100644 index e69de29..0000000