@@ -54,12 +54,13 @@ function link_is_addon_linked {
5454}
5555
5656
57- # link_module_impl <source_path> <dest_path> <force: on|off> <py-deps-manifest: on|off>
57+ # link_module_impl <source_path> <dest_path> <force: on|off> <py-deps-manifest: on|off> <fetch-recursive: on|off>
5858function link_module_impl {
5959 local src; src=$( readlink -f " $1 " ) ;
6060 local dest=$2 ;
6161 local force=$3 ;
62- local py_deps_manifest=" ${4:- off} " ;
62+ local py_deps_manifest=" $4 " ;
63+ local fetch_recursive=" $5 " ;
6364
6465 if [ " $force " == " on" ] && { [ -e " $dest " ] || [ -L " $dest " ]; }; then
6566 echov " Rewriting module $dest ..." ;
@@ -79,9 +80,12 @@ function link_module_impl {
7980 else
8081 echov " Module $src already linked to $dest " ;
8182 fi
82- fetch_requirements " $dest " ;
8383 fetch_pip_requirements " $dest " ;
84- fetch_oca_requirements " $dest " ;
84+
85+ if [ " $fetch_recursive " == " on" ]; then
86+ fetch_requirements " $dest " ;
87+ fetch_oca_requirements " $dest " ;
88+ fi
8589
8690 if [ " $py_deps_manifest " == " on" ] && [ -f " $dest /__manifest__.py" ]; then
8791 local py_deps;
@@ -98,10 +102,12 @@ function link_module_impl {
98102# --force
99103# --module-name <module name>
100104# --fetch-manifest-py-deps
105+ # --fetch-recursive <on|off>
101106function link_module {
102107 local force=off;
103108 local fetch_manifest_py_deps=off;
104109 local module_name;
110+ local fetch_recursive=on;
105111
106112 # Parse command line options and run commands
107113 if [[ $# -lt 1 ]]; then
@@ -124,6 +130,10 @@ function link_module {
124130 module_name=" $2 " ;
125131 shift ;
126132 ;;
133+ --fetch-recursive)
134+ fetch_recursive=" $2 " ;
135+ shift ;
136+ ;;
127137 * )
128138 echo " Unknown option $key " ;
129139 return 1;
@@ -153,26 +163,28 @@ function link_module {
153163 # single module repo
154164 local basename_repo;
155165 basename_repo=$( basename " $repo_path " ) ;
156- link_module_impl " $repo_path " " $ADDONS_DIR /${module_name:- $basename_repo } " " $force " " $fetch_manifest_py_deps " ;
166+ link_module_impl " $repo_path " " $ADDONS_DIR /${module_name:- $basename_repo } " " $force " " $fetch_manifest_py_deps " " $fetch_recursive " ;
157167 else
158168 # multi module repo
159169 if [ -z " $module_name " ]; then
160170 # Check for requirements files in repository root dir
161- fetch_requirements " $repo_path " ;
162171 fetch_pip_requirements " $repo_path " ;
163- fetch_oca_requirements " $repo_path " ;
172+ if [ " $fetch_recursive " == " on" ]; then
173+ fetch_requirements " $repo_path " ;
174+ fetch_oca_requirements " $repo_path " ;
175+ fi
164176
165177 # No module name specified, then all modules in repository should be linked
166178 for file in " $repo_path " /* ; do
167179 local base_filename;
168180 base_filename=$( basename " $file " ) ;
169181 if is_odoo_module " $file " && addons_is_installable " $file " ; then
170182 # link module
171- link_module_impl " $file " " $ADDONS_DIR /$base_filename " " $force " " $fetch_manifest_py_deps " ;
183+ link_module_impl " $file " " $ADDONS_DIR /$base_filename " " $force " " $fetch_manifest_py_deps " " $fetch_recursive " ;
172184 elif [ -d " $file " ] && ! is_odoo_module " $file " && [ " $base_filename " != ' setup' ]; then
173185 # if it is directory but not odoo module,
174186 # and not 'setup' dir, then recursively look for addons there
175- local link_module_opts=( );
187+ local link_module_opts=( --fetch-recursive " $fetch_recursive " );
176188 if [ " $force " == on ]; then
177189 link_module_opts+=( --force )
178190 fi
@@ -184,7 +196,7 @@ function link_module {
184196 done
185197 else
186198 # Module name specified, then only single module should be linked
187- link_module_impl " $repo_path /$module_name " " $ADDONS_DIR /$module_name " " $force " " $fetch_manifest_py_deps " ;
199+ link_module_impl " $repo_path /$module_name " " $ADDONS_DIR /$module_name " " $force " " $fetch_manifest_py_deps " " $fetch_recursive " ;
188200 fi
189201 fi
190202}
@@ -200,6 +212,7 @@ function link_command {
200212 -f|--force - rewrite links if already exists
201213 --fetch-manifest-py-deps - fetch python dependencies from addon's manifest
202214 --module-name <name> - name of module to link from repo
215+ --no-fetch - Do not fetch repositories recursively
203216 --ual - update addons list after link
204217 " ;
205218
@@ -231,6 +244,9 @@ function link_command {
231244 link_module_opts+=( --module-name " $2 " );
232245 shift ;
233246 ;;
247+ --no-fetch)
248+ link_module_opts+=( --fetch-recursive off );
249+ ;;
234250 --ual)
235251 ual=1;
236252 ;;
0 commit comments