-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the help a bit clearer. Fix problem if the manifest of a module …
…uses set for assets. Bump version
- Loading branch information
1 parent
17b34da
commit d8643d5
Showing
5 changed files
with
109 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
diff --git a/src/odoo_analyse/__init__.py b/src/odoo_analyse/__init__.py | ||
index 071b5fc..893b12c 100644 | ||
--- a/src/odoo_analyse/__init__.py | ||
+++ b/src/odoo_analyse/__init__.py | ||
@@ -19,4 +19,4 @@ __all__ = [ | ||
"geometric_mean", | ||
] | ||
|
||
-VERSION = "1.6.0" | ||
+VERSION = "1.6.1" | ||
diff --git a/src/odoo_analyse/__main__.py b/src/odoo_analyse/__main__.py | ||
index a8ed971..39a3f73 100644 | ||
--- a/src/odoo_analyse/__main__.py | ||
+++ b/src/odoo_analyse/__main__.py | ||
@@ -54,7 +54,7 @@ def parser_load_save(parser): | ||
"--path", | ||
default=[], | ||
action="append", | ||
- help="Specify a path to search for odoo modules", | ||
+ help="Specify a path to search for odoo modules. Multiple use is supported", | ||
) | ||
parser.add_argument( | ||
"-l", | ||
@@ -121,7 +121,7 @@ def parser_filters(parser): | ||
"--modules", | ||
default="*", | ||
help="Filter out modules which names aren't matching the glob. " | ||
- "Separate multiple filters by comma. Use `-` load load from stdin", | ||
+ "Separate multiple filters by comma. Use `-` to load from stdin", | ||
) | ||
parser.add_argument( | ||
"--views", | ||
diff --git a/src/odoo_analyse/odoo.py b/src/odoo_analyse/odoo.py | ||
index f9c1c24..aa484eb 100644 | ||
--- a/src/odoo_analyse/odoo.py | ||
+++ b/src/odoo_analyse/odoo.py | ||
@@ -10,6 +10,7 @@ from configparser import ConfigParser | ||
from fnmatch import fnmatch | ||
from functools import reduce | ||
|
||
+from . import utils | ||
from .module import Module | ||
|
||
try: | ||
@@ -331,10 +332,10 @@ class Odoo: | ||
"""Output the analyse result as JSON""" | ||
# Write to a file or stdout | ||
if file_path == "-": | ||
- print(json.dumps(data, indent=2)) | ||
+ print(json.dumps(data, indent=2, cls=utils.JSONEncoder)) | ||
else: | ||
with open(file_path, "w+", encoding="utf-8") as fp: | ||
- json.dump(data, fp, indent=2) | ||
+ json.dump(data, fp, indent=2, cls=utils.JSONEncoder) | ||
|
||
def load_path(self, paths, depth=None, **config): | ||
if isinstance(paths, str): | ||
@@ -358,10 +359,10 @@ class Odoo: | ||
def save_json(self, filename): | ||
data = {k: m.to_json() for k, m in self.full.items()} | ||
if filename == "-": | ||
- json.dump(data, sys.stdout) | ||
+ json.dump(data, sys.stdout, cls=utils.JSONEncoder) | ||
else: | ||
with open(filename, "w+", encoding="utf-8") as fp: | ||
- json.dump(data, fp) | ||
+ json.dump(data, fp, cls=utils.JSONEncoder) | ||
|
||
def _find_edges_in_loop(self, graph): # pylint: disable=R0201 | ||
# Eliminate not referenced and not referring modules | ||
diff --git a/src/odoo_analyse/utils.py b/src/odoo_analyse/utils.py | ||
index a52c319..3ff1bd2 100644 | ||
--- a/src/odoo_analyse/utils.py | ||
+++ b/src/odoo_analyse/utils.py | ||
@@ -14,6 +14,13 @@ from json.decoder import JSONDecodeError | ||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
+class JSONEncoder(json.JSONEncoder): | ||
+ def default(self, o): | ||
+ if isinstance(o, (tuple, set)): | ||
+ return list(o) | ||
+ return super().default(o) | ||
+ | ||
+ | ||
def call(cmd, cwd=None): | ||
with subprocess.Popen( | ||
cmd, |
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 |
---|---|---|
|
@@ -19,4 +19,4 @@ | |
"geometric_mean", | ||
] | ||
|
||
VERSION = "1.6.0" | ||
VERSION = "1.6.1" |
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
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
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