-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from sbidoul/ref-oca_install_addons
Refactor oca_install_addons
- Loading branch information
Showing
2 changed files
with
60 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,2 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Install dependencies of addons to test, and add addons to test to Odoo's addons_path. | ||
# | ||
# An alternative technique would be to install all addons with `pip install --editable` | ||
# but it is relatively slow in repos with a large number of addons. This is an area | ||
# where pip could improve. | ||
# | ||
|
||
set -ex | ||
shopt -s nullglob # in case there is setup.py nor pyproject.toml | ||
|
||
# Compute and install direct dependencies of installable addons in $ADDONS_DIR | ||
# (this includes addons, python external dependencies and odoo itself). | ||
# The environment variables are for better perfomance as we are interested in | ||
# the dependencies metadata only, and not the exact versions. | ||
# --no-isolation is for performance. The Dockerfile has setuptools-odoo and whool | ||
# preinstalled in the same environment as pyproject-dependencies. | ||
# --ignore-build-errors is needed to avoid errors with uninstallable addons. | ||
env SETUPTOOLS_ODOO_POST_VERSION_STRATEGY_OVERRIDE=none \ | ||
WHOOL_POST_VERSION_STRATEGY_OVERRIDE=none \ | ||
pyproject-dependencies \ | ||
--no-isolation \ | ||
--ignore-build-errors \ | ||
${ADDONS_DIR}/*/pyproject.toml ${ADDONS_DIR}/setup/*/setup.py \ | ||
>> test-requirements.txt | ||
cat test-requirements.txt | ||
|
||
# To be sure to install addons from this repo if they are dependencies of dependencies, | ||
# we create a constraints file with local directory references to the addons to test. | ||
if python -c 'import sys; sys.exit(sys.version_info < (3,6))' ; then | ||
# python >= 3.6 | ||
oca_list_addons_to_test_as_reqs >> test-constraints.txt | ||
else | ||
# old python where pip does not support URL constraints | ||
touch test-constraints.txt | ||
fi | ||
cat test-constraints.txt | ||
|
||
# show pip config | ||
pip config list | ||
|
||
# Install dependencies of addons to test. | ||
pip install -r test-requirements.txt -c test-constraints.txt | ||
|
||
# show what we have installed | ||
pip freeze | ||
|
||
# Add ADDONS_DIR to addons_path. | ||
echo "addons_path=${ADDONS_PATH},${ADDONS_DIR}" >> ${ODOO_RC} | ||
cat ${ODOO_RC} | ||
|
||
deps=$(oca_list_external_dependencies deb) | ||
if [ -n "$deps" ]; then | ||
apt-get update -qq | ||
# Install 'deb' external dependencies of all Odoo addons found in path. | ||
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends ${deps} | ||
fi | ||
oca_install_addons__deps_and_addons_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Install dependencies of addons to test, and add addons to test to Odoo's addons_path. | ||
# | ||
# An alternative technique would be to install all addons with `pip install --editable` | ||
# but it is relatively slow in repos with a large number of addons. This is an area | ||
# where pip could improve. | ||
# | ||
|
||
set -ex | ||
shopt -s nullglob # in case there is setup.py nor pyproject.toml | ||
|
||
# Compute and install direct dependencies of installable addons in $ADDONS_DIR | ||
# (this includes addons, python external dependencies and odoo itself). | ||
# The environment variables are for better perfomance as we are interested in | ||
# the dependencies metadata only, and not the exact versions. | ||
# --no-isolation is for performance. The Dockerfile has setuptools-odoo and whool | ||
# preinstalled in the same environment as pyproject-dependencies. | ||
# --ignore-build-errors is needed to avoid errors with uninstallable addons. | ||
env SETUPTOOLS_ODOO_POST_VERSION_STRATEGY_OVERRIDE=none \ | ||
WHOOL_POST_VERSION_STRATEGY_OVERRIDE=none \ | ||
pyproject-dependencies \ | ||
--no-isolation \ | ||
--ignore-build-errors \ | ||
${ADDONS_DIR}/*/pyproject.toml ${ADDONS_DIR}/setup/*/setup.py \ | ||
>> test-requirements.txt | ||
cat test-requirements.txt | ||
|
||
# To be sure to install addons from this repo if they are dependencies of dependencies, | ||
# we create a constraints file with local directory references to the addons to test. | ||
if python -c 'import sys; sys.exit(sys.version_info < (3,6))' ; then | ||
# python >= 3.6 | ||
oca_list_addons_to_test_as_reqs >> test-constraints.txt | ||
else | ||
# old python where pip does not support URL constraints | ||
touch test-constraints.txt | ||
fi | ||
cat test-constraints.txt | ||
|
||
# show pip config | ||
pip config list | ||
|
||
# Install dependencies of addons to test. | ||
pip install -r test-requirements.txt -c test-constraints.txt | ||
|
||
# show what we have installed | ||
pip freeze | ||
|
||
# Add ADDONS_DIR to addons_path. | ||
echo "addons_path=${ADDONS_PATH},${ADDONS_DIR}" >> ${ODOO_RC} | ||
cat ${ODOO_RC} | ||
|
||
deps=$(oca_list_external_dependencies deb) | ||
if [ -n "$deps" ]; then | ||
apt-get update -qq | ||
# Install 'deb' external dependencies of all Odoo addons found in path. | ||
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends ${deps} | ||
fi |