summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-05-03 16:55:59 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-05-03 17:06:49 +0200
commitdb57523e7846a6729f0ca0681e7e998b537e5b81 (patch)
tree8c424d54c287ec05a65530f56dfb2f507cba12a7 /src/scripts
parent767631e304b7142669d4f44f13cb97010348de11 (diff)
eolian: refactor parsing API and path handling
This splits the eolian_file_parse API into two, one for parsing files already present in the database (always by filename) and one for parsing paths. It fixes several bugs/leaks on the way (incorrect use of stringshare etc.) as well as adds checking for whether there are no conflicting filenames at scan time, for free. That means it is now no longer possible to scan two paths which have an eo or eot file of the same name in them. It should also be faster now. It also fixes T7820. @fix
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/pyolian/eolian.py8
-rw-r--r--src/scripts/pyolian/eolian_lib.py6
2 files changed, 11 insertions, 3 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 70ab733ce5..84e3f480ed 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -422,8 +422,12 @@ class Eolian_State(Eolian_Unit):
422 def __repr__(self): 422 def __repr__(self):
423 return "<eolian.Eolian_State, %d units loaded>" % len(list(self.units)) 423 return "<eolian.Eolian_State, %d units loaded>" % len(list(self.units))
424 424
425 def file_parse(self, filepath): 425 def file_parse(self, filename):
426 c_unit = lib.eolian_state_file_parse(self, _str_to_bytes(filepath)) 426 c_unit = lib.eolian_state_file_parse(self, _str_to_bytes(filename))
427 return Eolian_Unit(c_unit) if c_unit else None
428
429 def file_path_parse(self, filepath):
430 c_unit = lib.eolian_state_file_path_parse(self, _str_to_bytes(filepath))
427 return Eolian_Unit(c_unit) if c_unit else None 431 return Eolian_Unit(c_unit) if c_unit else None
428 432
429 @property 433 @property
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 9edebd0199..6e9f9cb1a6 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -52,10 +52,14 @@ lib.eolian_state_new.restype = c_void_p
52lib.eolian_state_free.argtypes = (c_void_p,) 52lib.eolian_state_free.argtypes = (c_void_p,)
53lib.eolian_state_free.restype = None 53lib.eolian_state_free.restype = None
54 54
55# EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filepath); 55# EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filename);
56lib.eolian_state_file_parse.argtypes = (c_void_p, c_char_p) 56lib.eolian_state_file_parse.argtypes = (c_void_p, c_char_p)
57lib.eolian_state_file_parse.restype = c_void_p 57lib.eolian_state_file_parse.restype = c_void_p
58 58
59# EAPI const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, const char *filepath);
60lib.eolian_state_file_path_parse.argtypes = (c_void_p, c_char_p)
61lib.eolian_state_file_path_parse.restype = c_void_p
62
59# EAPI Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State *state); 63# EAPI Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State *state);
60lib.eolian_state_eo_file_paths_get.argtypes = (c_void_p,) 64lib.eolian_state_eo_file_paths_get.argtypes = (c_void_p,)
61lib.eolian_state_eo_file_paths_get.restype = c_void_p 65lib.eolian_state_eo_file_paths_get.restype = c_void_p