diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-14 17:47:37 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-14 17:47:37 +0300 |
commit | ca3cc95f3d8619a6afa256964b062a7469f3b352 (patch) | |
tree | 3b6c5e0024672207bb374c8836ad8201b0a830b8 /release | |
parent | 94aa5c0dd693a406517c2cd4865581794cf3368e (diff) | |
parent | 3eae5f71d15e35f789996c185241275edd3125fa (diff) |
Merge branch 'property-search-button-label-pointer' into property-search-move-context-to-panel
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/bl_extract_messages.py | 21 | ||||
-rw-r--r-- | release/scripts/modules/bpy/utils/__init__.py | 2 |
2 files changed, 14 insertions, 9 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index cee8f89abd3..b4abf572dbc 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -456,9 +456,11 @@ def dump_py_messages_from_files(msgs, reports, files, settings): Recursively get strings, needed in case we have "Blah" + "Blah", passed as an argument in that case it won't evaluate to a string. However, break on some kind of stopper nodes, like e.g. Subscript. """ - if type(node) == ast.Str: + # New in py 3.8: all constants are of type 'ast.Constant'. + # 'ast.Str' will have to be removed when we officially switch to this version. + if type(node) in {ast.Str, getattr(ast, "Constant", None)}: eval_str = ast.literal_eval(node) - if eval_str: + if eval_str and type(eval_str) == str: yield (is_split, eval_str, (node,)) else: is_split = (type(node) in separate_nodes) @@ -624,6 +626,7 @@ def dump_py_messages_from_files(msgs, reports, files, settings): } for fp in files: + # ~ print("Checking File ", fp) with open(fp, 'r', encoding="utf8") as filedata: root_node = ast.parse(filedata.read(), fp, 'exec') @@ -631,8 +634,8 @@ def dump_py_messages_from_files(msgs, reports, files, settings): for node in ast.walk(root_node): if type(node) == ast.Call: - # print("found function at") - # print("%s:%d" % (fp, node.lineno)) + # ~ print("found function at") + # ~ print("%s:%d" % (fp, node.lineno)) # We can't skip such situations! from blah import foo\nfoo("bar") would also be an ast.Name func! if type(node.func) == ast.Name: @@ -657,31 +660,31 @@ def dump_py_messages_from_files(msgs, reports, files, settings): if kw.arg == arg_kw: context_elements[arg_kw] = kw.value break - # print(context_elements) + # ~ print(context_elements) for kws, proc in translate_kw[msgid]: if set(kws) <= context_elements.keys(): args = tuple(context_elements[k] for k in kws) - #print("running ", proc, " with ", args) + # ~ print("running ", proc, " with ", args) ctxt = proc(*args) if ctxt: msgctxts[msgid] = ctxt break - # print(translate_args) + # ~ print(func_args) # do nothing if not found for arg_kw, (arg_pos, _) in func_args.items(): msgctxt = msgctxts[arg_kw] estr_lst = [(None, ())] if arg_pos < len(node.args): estr_lst = extract_strings_split(node.args[arg_pos]) - #print(estr, nds) else: for kw in node.keywords: if kw.arg == arg_kw: + # ~ print(kw.arg, kw.value) estr_lst = extract_strings_split(kw.value) break - #print(estr, nds) for estr, nds in estr_lst: + # ~ print(estr, nds) if estr: if nds: msgsrc = "{}:{}".format(fp_rel, sorted({nd.lineno for nd in nds})[0]) diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index 8a67a598ccd..4e0220ee1cc 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -283,6 +283,8 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): del _initialize if reload_scripts: + _bpy.context.window_manager.tag_script_reload() + import gc print("gc.collect() -> %d" % gc.collect()) |