Skip to content
Snippets Groups Projects
Commit 662eae0c6924 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:ambulance: fix reading other_sources key

parent 085983182fe6
No related branches found
No related tags found
1 merge request!58Topic/default/fix other sources
......@@ -2,6 +2,11 @@
History
=======
11.0.1
------
Fix reading other sources from setup, it was only accepting directories.
11.0.0
------
......
......@@ -10,6 +10,7 @@
from typing import List, Optional
SECTION = "odoo_scripts"
OTHER_SOURCES_KEY = "other_sources"
_logger = logging.getLogger(__name__)
......@@ -106,10 +107,10 @@
self._expanded_configuration[name] = Configuration(**value)
def set_from_glob_values(
base: Optional[str], glob_values: List[str]
base: Optional[str], glob_values: List[str], only_directories: bool
) -> set:
result_set = set()
for glob_value in glob_values:
if base:
glob_value = os.path.join(base, glob_value)
for file in glob(glob_value):
......@@ -110,10 +111,10 @@
) -> set:
result_set = set()
for glob_value in glob_values:
if base:
glob_value = os.path.join(base, glob_value)
for file in glob(glob_value):
if os.path.isdir(file):
if not only_directories or os.path.isdir(file):
result_set.add(file)
return result_set
......@@ -124,7 +125,7 @@
return True
# those keys are path to files (glob compatible)
for key in ("modules", "dependencies", "other_sources"):
for key in ("modules", "dependencies", OTHER_SOURCES_KEY):
set_values = set()
if toread(key):
# add any expanded values
......@@ -133,7 +134,11 @@
# get the values from this configuration
values = section.get(key, "").split()
# XXX eventually add option to not include path
set_values.update(set_from_glob_values(path, values))
set_values.update(
set_from_glob_values(
path, values, key != OTHER_SOURCES_KEY
)
)
setattr(self, key, list(set_values))
def key_format(a_key: str) -> str:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment