-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for pip install of odoo and addons #62
Conversation
Hi Jordi, thank you for this first PR! |
vars/main.yml
Outdated
@@ -14,6 +14,7 @@ odoo_pypi_packages: | |||
- psycogreen | |||
|
|||
odoo_buildout_venv_cmd: "virtualenv --no-setuptools {{ odoo_buildout_venv_path }}" | |||
odoo_venv_cmd: "virtualenv {{ odoo_venv_path }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to odoo_pip_venv_cmd
defaults/main.yml
Outdated
@@ -105,6 +105,9 @@ odoo_config_custom: {} | |||
#your_option1: value1 | |||
#your_option2: value2 | |||
|
|||
# Pip installation options (odoo_install_type == 'pip') | |||
odoo_venv_path: "{{ odoo_workdir }}/sandbox" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to odoo_pip_venv_path
@sebalix Thanks! I have applied the fixes as suggested. |
@jbeficent can you remove |
7820447
to
fa36629
Compare
This is now looking better. I added tests for the pip install method. Still have to resolve why in some versions is failing |
fa36629
to
75f1434
Compare
Nice work!
EDIT: maybe not needed, see the next comment |
Or try to generate the virtualenv without setuptools ( |
templates/odoo-10.0.conf
Outdated
@@ -1,5 +1,5 @@ | |||
[options] | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_config_addons_path }} | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_install_type == 'standard' and odoo_config_addons_path or ''}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addons_path
can be used as a list with the standard
install type:
addons_path:
- /path/1
- /path/2
Or with a string as usual.
To fix that with pip
install type, I would prefer to be more explicit:
{% if odoo_install_type == 'pip' %}
addons_path =
{% else %}
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_config_addons_path }}
{% endif %}
templates/odoo-11.0.conf
Outdated
@@ -1,5 +1,5 @@ | |||
[options] | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_config_addons_path }} | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_install_type == 'standard' and odoo_config_addons_path or ''}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.
templates/odoo-9.0.conf
Outdated
@@ -1,5 +1,5 @@ | |||
[options] | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_config_addons_path }} | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_install_type == 'standard' and odoo_config_addons_path or ''}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.
templates/odoo-8.0.conf
Outdated
@@ -1,5 +1,5 @@ | |||
[options] | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_config_addons_path }} | |||
addons_path = {{ odoo_config_addons_path.__class__.__name__ == 'list' and odoo_config_addons_path | join(',') or odoo_install_type == 'standard' and odoo_config_addons_path or ''}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.
@@ -14,6 +14,7 @@ odoo_pypi_packages: | |||
- psycogreen | |||
|
|||
odoo_buildout_venv_cmd: "virtualenv --no-setuptools {{ odoo_buildout_venv_path }}" | |||
odoo_pip_venv_cmd: "virtualenv {{ odoo_pip_venv_path }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To try with --no-setuptools
?
vars/Ubuntu-16_Odoo-8.yml
Outdated
@@ -52,6 +72,8 @@ odoo_buildout_build_dependencies: | |||
- libfreetype6-dev | |||
- liblcms2-dev | |||
- libwebp-dev | |||
- libssl-dev | |||
- python-wrapt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why these packages are added to odoo_buildout_build_dependencies
? (especially python-wrapt)
@@ -87,6 +107,7 @@ odoo_wkhtmltox_depends: | |||
- libjpeg-turbo8 | |||
|
|||
odoo_buildout_venv_cmd: "virtualenv --no-setuptools --python=python3 {{ odoo_buildout_venv_path }}" | |||
odoo_pip_venv_cmd: "virtualenv --python=python3 {{ odoo_pip_venv_path }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To try with --no-setuptools
.
@@ -66,6 +86,7 @@ odoo_buildout_build_dependencies: | |||
- libwebp-dev | |||
|
|||
odoo_buildout_venv_cmd: "python3 -m virtualenv --no-setuptools --python=python3 {{ odoo_buildout_venv_path }}" | |||
odoo_pip_venv_cmd: "python3 -m virtualenv --python=python3 {{ odoo_pip_venv_path }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To try with --no-setuptools
(if it works we will reduce the dependency against an old version of setuptools
provided by Debian Stretch).
tests/test_pip_changed.yml
Outdated
- ansible-odoo | ||
vars: | ||
odoo_install_type: pip | ||
odoo_repo_type: pip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is odoo_repo_type
useful?
tests/test_pip.yml
Outdated
- ansible-odoo | ||
vars: | ||
odoo_install_type: pip | ||
odoo_repo_type: pip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is odoo_repo_type
useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that we do not want to execute the task 'Clone project repository (Git)' https://github.com/osiell/ansible-odoo/blob/master/tasks/install.yml#L52. How can we ensure that this part is skipped when we install with pip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok,
Then you can replace the line you point by this:
when: odoo_install_type != 'pip' and odoo_repo_type == 'git' and odoo_repo_url
And do the same with https://github.com/osiell/ansible-odoo/blob/master/tasks/install.yml#L37 for Mercurial repositories.
75f1434
to
6d681a3
Compare
@sebalix I pushed one more fix and now Travis complains everywhere. Not sure why :S |
vars/Debian-8_Odoo-10.yml
Outdated
- setuptools==30.0.0 | ||
- odoo-autodiscover==2.0.0 | ||
- setuptools-git==1.2 | ||
- setuptools-odoo==2.0.2.post1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis fails because the standard
install type is using odoo_pypi_packages
to install some packages (not available as a Debian package) at the system level with pip
.
Re-using this for others purposes is not ideal, you should use another variable for that, e.g odoo_pip_dependencies
(in order to be consistent with odoo_pip_build_dependencies
)
@jbeficent I wonder why you can't put the content of The problem I see on Travis is that Ansible installs dependencies at first from |
@jbeficent done |
This is the error without wrapt
|
cc3e892
to
4c78794
Compare
I have now pushed again, with wrapt. |
Okay... Very strange, it tries to install it from |
Can you cancel prior travis builds? |
Yep, done |
To speed up tests, we could download Odoo sources from a .tar.gz (e.g. https://github.com/odoo/odoo/archive/10.0.tar.gz#egg=odoo , ~100Mb) which is must faster than downloading the whole Odoo git repository (2,5Go I think?).
|
Then we'd need a requirements.txt file just for the tests, right? |
If Odoo 10.0 deployment is working on Debian Stretch but not on Debian Jessie, maybe it's due to the pip version. |
We can try, but perhaps we loose the idempotency. We can see what is the result of the current testing |
@jbeficent the ones you wrote are enough (templates/odoo-X-pip-requirements.txt) no? |
Regarding The great advantage with a recent version of pip is the use of Wheel package format which also speed up the installation of some packages (e.g. lxml, psycopg2, gevent, greenlet...). I'm using this in the buildout example recipe used by this role: https://github.com/osiell/odoo-buildout-example/blob/8.0/buildout.cfg |
4c78794
to
233c7a2
Compare
OK, I have applied the changes you suggest, including downloading odoo from tar.gz. Let's see the results now.. |
tasks/install_pip.yml
Outdated
cache_valid_time={{ odoo_apt_cache_valid_time }} | ||
with_items: "{{ odoo_debian_packages }}" | ||
tags: | ||
- odoo_packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see this part, can we remove it? There is only python-dev
which seems useful, and it is already included in odoo_pip_build_dependencies
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Please cancel the previous build. I am not yet familiar with tags and what they are useful for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I was referring to the whole "Install Odoo dependencies" task which process odoo_debian_packages
:)
About Ansible tags, it allows to execute only some parts of the role via the ansible-playbook command with the -t
option, for instance -t odoo_config,odoo_postgresql
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, Ok. I just removed it. Somehow it was requiring on a previous test. But let's see now.
2b81d21
to
5a82524
Compare
I know I'm annoying, there is only the .gitignore and .idea folder to remove and this PR will be almost ready to be merged. |
5a82524
to
d3bdb4a
Compare
@sebalix Ok, fixed! I wonder why https://travis-ci.org/osiell/ansible-odoo/jobs/332368800 failed. Seems not really related to the configuration, but a generic server error. |
Yes, it is not related to the PR, this is the LXD image mirror which was down. |
vars/Ubuntu-16_Odoo-10.yml
Outdated
@@ -67,6 +90,7 @@ odoo_buildout_build_dependencies: | |||
- libfreetype6-dev | |||
- liblcms2-dev | |||
- libwebp-dev | |||
- python-wrapt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I forgot this one ;) To remove please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
d3bdb4a
to
440147c
Compare
@sebalix People can also specify https://wheelhouse.odoo-community.org/oca-simple/ in their requirements.txt file, and that would also speed up the install significantly. Another interesting idea is to maintain a set of already packaged wheels for the python packages often used, like in https://wheelhouse.acsone.eu/odoo-requirements-ubuntu. This would help to greatly improve the speed to install. |
The problem I see with https://wheelhouse.acsone.eu/odoo-requirements-ubuntu/ is that you would have to trust the sources. With the pip install method it is not easy to verify if the packages are safe. |
Great to know, there is space for improvements! |
Good to merge for me! Thanks for your review!!!!! |
This is an initial attempt to make the project compatible with the pip install approach proposed here: https://odoo-community.org/blog/our-blog-1/post/installing-oca-addons-the-easy-way-32
I was not able to successfully make it work, but hopefully this can be an starting point for an ongoing discussion.