Skip to content

Commit ec902ec

Browse files
authored
Merge pull request #61 from sbidoul/ref-oca_install_addons
Refactor oca_install_addons
2 parents a5f2266 + 5dd8687 commit ec902ec

File tree

2 files changed

+60
-58
lines changed

2 files changed

+60
-58
lines changed

bin/oca_install_addons

+1-58
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,2 @@
11
#!/bin/bash
2-
3-
#
4-
# Install dependencies of addons to test, and add addons to test to Odoo's addons_path.
5-
#
6-
# An alternative technique would be to install all addons with `pip install --editable`
7-
# but it is relatively slow in repos with a large number of addons. This is an area
8-
# where pip could improve.
9-
#
10-
11-
set -ex
12-
shopt -s nullglob # in case there is setup.py nor pyproject.toml
13-
14-
# Compute and install direct dependencies of installable addons in $ADDONS_DIR
15-
# (this includes addons, python external dependencies and odoo itself).
16-
# The environment variables are for better perfomance as we are interested in
17-
# the dependencies metadata only, and not the exact versions.
18-
# --no-isolation is for performance. The Dockerfile has setuptools-odoo and whool
19-
# preinstalled in the same environment as pyproject-dependencies.
20-
# --ignore-build-errors is needed to avoid errors with uninstallable addons.
21-
env SETUPTOOLS_ODOO_POST_VERSION_STRATEGY_OVERRIDE=none \
22-
WHOOL_POST_VERSION_STRATEGY_OVERRIDE=none \
23-
pyproject-dependencies \
24-
--no-isolation \
25-
--ignore-build-errors \
26-
${ADDONS_DIR}/*/pyproject.toml ${ADDONS_DIR}/setup/*/setup.py \
27-
>> test-requirements.txt
28-
cat test-requirements.txt
29-
30-
# To be sure to install addons from this repo if they are dependencies of dependencies,
31-
# we create a constraints file with local directory references to the addons to test.
32-
if python -c 'import sys; sys.exit(sys.version_info < (3,6))' ; then
33-
# python >= 3.6
34-
oca_list_addons_to_test_as_reqs >> test-constraints.txt
35-
else
36-
# old python where pip does not support URL constraints
37-
touch test-constraints.txt
38-
fi
39-
cat test-constraints.txt
40-
41-
# show pip config
42-
pip config list
43-
44-
# Install dependencies of addons to test.
45-
pip install -r test-requirements.txt -c test-constraints.txt
46-
47-
# show what we have installed
48-
pip freeze
49-
50-
# Add ADDONS_DIR to addons_path.
51-
echo "addons_path=${ADDONS_PATH},${ADDONS_DIR}" >> ${ODOO_RC}
52-
cat ${ODOO_RC}
53-
54-
deps=$(oca_list_external_dependencies deb)
55-
if [ -n "$deps" ]; then
56-
apt-get update -qq
57-
# Install 'deb' external dependencies of all Odoo addons found in path.
58-
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends ${deps}
59-
fi
2+
oca_install_addons__deps_and_addons_path
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
#
4+
# Install dependencies of addons to test, and add addons to test to Odoo's addons_path.
5+
#
6+
# An alternative technique would be to install all addons with `pip install --editable`
7+
# but it is relatively slow in repos with a large number of addons. This is an area
8+
# where pip could improve.
9+
#
10+
11+
set -ex
12+
shopt -s nullglob # in case there is setup.py nor pyproject.toml
13+
14+
# Compute and install direct dependencies of installable addons in $ADDONS_DIR
15+
# (this includes addons, python external dependencies and odoo itself).
16+
# The environment variables are for better perfomance as we are interested in
17+
# the dependencies metadata only, and not the exact versions.
18+
# --no-isolation is for performance. The Dockerfile has setuptools-odoo and whool
19+
# preinstalled in the same environment as pyproject-dependencies.
20+
# --ignore-build-errors is needed to avoid errors with uninstallable addons.
21+
env SETUPTOOLS_ODOO_POST_VERSION_STRATEGY_OVERRIDE=none \
22+
WHOOL_POST_VERSION_STRATEGY_OVERRIDE=none \
23+
pyproject-dependencies \
24+
--no-isolation \
25+
--ignore-build-errors \
26+
${ADDONS_DIR}/*/pyproject.toml ${ADDONS_DIR}/setup/*/setup.py \
27+
>> test-requirements.txt
28+
cat test-requirements.txt
29+
30+
# To be sure to install addons from this repo if they are dependencies of dependencies,
31+
# we create a constraints file with local directory references to the addons to test.
32+
if python -c 'import sys; sys.exit(sys.version_info < (3,6))' ; then
33+
# python >= 3.6
34+
oca_list_addons_to_test_as_reqs >> test-constraints.txt
35+
else
36+
# old python where pip does not support URL constraints
37+
touch test-constraints.txt
38+
fi
39+
cat test-constraints.txt
40+
41+
# show pip config
42+
pip config list
43+
44+
# Install dependencies of addons to test.
45+
pip install -r test-requirements.txt -c test-constraints.txt
46+
47+
# show what we have installed
48+
pip freeze
49+
50+
# Add ADDONS_DIR to addons_path.
51+
echo "addons_path=${ADDONS_PATH},${ADDONS_DIR}" >> ${ODOO_RC}
52+
cat ${ODOO_RC}
53+
54+
deps=$(oca_list_external_dependencies deb)
55+
if [ -n "$deps" ]; then
56+
apt-get update -qq
57+
# Install 'deb' external dependencies of all Odoo addons found in path.
58+
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends ${deps}
59+
fi

0 commit comments

Comments
 (0)