diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..bac9f68e --- /dev/null +++ b/.pylintrc @@ -0,0 +1,120 @@ +[MASTER] +load-plugins=pylint_odoo +score=n + +[ODOOLINT] +manifest_required_authors=Hibou Corp. +manifest_required_keys=license +manifest_deprecated_keys=description,active +license_allowed=OPL-1,AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 +valid_odoo_versions=15.0 + +[MESSAGES CONTROL] +disable=all + +# This .pylintrc contains optional AND mandatory checks and is meant to be +# loaded in an IDE to have it check everything, in the hope this will make +# optional checks more visible to contributors who otherwise never look at a +# green travis to see optional checks that failed. +# .pylintrc-mandatory containing only mandatory checks is used the pre-commit +# config as a blocking check. + +enable=anomalous-backslash-in-string, + api-one-deprecated, + api-one-multi-together, + assignment-from-none, + attribute-deprecated, + class-camelcase, + dangerous-default-value, + dangerous-view-replace-wo-priority, + development-status-allowed, + duplicate-id-csv, + duplicate-key, + duplicate-xml-fields, + duplicate-xml-record-id, + eval-referenced, + eval-used, + incoherent-interpreter-exec-perm, + license-allowed, + manifest-author-string, + manifest-deprecated-key, + manifest-required-author, + manifest-required-key, + manifest-version-format, + method-compute, + method-inverse, + method-required-super, + method-search, + openerp-exception-warning, + pointless-statement, + pointless-string-statement, + print-used, + redundant-keyword-arg, + redundant-modulename-xml, + reimported, + relative-import, + return-in-init, + rst-syntax-error, + sql-injection, + too-few-format-args, + translation-field, + translation-required, + unreachable, + use-vim-comment, + wrong-tabs-instead-of-spaces, + xml-syntax-error, + attribute-string-redundant, + character-not-valid-in-resource-link, + consider-merging-classes-inherited, + context-overridden, + create-user-wo-reset-password, + dangerous-filter-wo-user, + dangerous-qweb-replace-wo-priority, + deprecated-data-xml-node, + deprecated-openerp-xml-node, + duplicate-po-message-definition, + except-pass, + file-not-used, + invalid-commit, + manifest-maintainers-list, + missing-newline-extrafiles, + missing-readme, + missing-return, + odoo-addons-relative-import, + old-api7-method-defined, + po-msgstr-variables, + po-syntax-error, + renamed-field-parameter, + resource-not-exist, + str-format-used, + test-folder-imported, + translation-contains-variable, + translation-positional-used, + unnecessary-utf8-coding-comment, + website-manifest-key-not-valid-uri, + xml-attribute-translatable, + xml-deprecated-qweb-directive, + xml-deprecated-tree-attribute, + # messages that do not cause the lint step to fail + consider-merging-classes-inherited, + create-user-wo-reset-password, + dangerous-filter-wo-user, + deprecated-module, + file-not-used, + invalid-commit, + missing-manifest-dependency, + missing-newline-extrafiles, + missing-readme, + no-utf8-coding-comment, + odoo-addons-relative-import, + old-api7-method-defined, + redefined-builtin, + too-complex, + unnecessary-utf8-coding-comment + + +[REPORTS] +msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} +output-format=colorized +reports=no + diff --git a/odoo-reload.py b/odoo-reload.py index a633c8e8..c8a46c87 100755 --- a/odoo-reload.py +++ b/odoo-reload.py @@ -5,25 +5,29 @@ import os import signal import sys -PID = 1 -PNAME = 'odoo' -PNAME_PYTHON = ['python'] -PNAME_KILL_OTHER = [PNAME] + PNAME_PYTHON +# once upon a time +# we tried to find 'odoo' and 'python' +# but sometimes, it would be something like "/usr/local/bin/...." +# so we now just try not to signal/kill 'node' +PID = 1 +PNAME = 'node' KILL_OTHER = sys.argv[1] == 'KILL_OTHER' if len(sys.argv) >= 2 else False if KILL_OTHER: print('Will find other Odoo Processes and Kill them.') is_foreground = False +foreground_name = '' for proc in psutil.process_iter(): try: process_name = proc.name() process_id = proc.pid print('Inspecting %s:%s' % (process_id, process_name)) if process_id == PID: - is_foreground = process_name == PNAME + is_foreground = process_name != PNAME + foreground_name = process_name if not KILL_OTHER: break - if process_id != PID and KILL_OTHER and process_name in PNAME_KILL_OTHER: + if process_id != PID and KILL_OTHER and process_name != PNAME: print('Killing %s:%s' % (process_id, process_name)) os.kill(process_id, signal.SIGKILL) except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): @@ -33,6 +37,6 @@ if not is_foreground: print('Odoo is not the foreground process.') exit(-1) -print('Signalling reload to Odoo') +print('Signalling reload to foreground process "%s"' % (foreground_name, )) os.kill(PID, signal.SIGHUP)