aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-12-16 17:42:18 +0200
committerYakov Goldberg <yakov.g@samsung.com>2012-12-16 18:39:18 +0200
commit1209e2c1e425f9c85d7e2662748d27bc2180a519 (patch)
tree224b00afc7fc136e3b193746ce0198f63507f1a8
parentTests updated (diff)
downloadeo_bindings-1209e2c1e425f9c85d7e2662748d27bc2180a519.tar.gz
Some stuff in command line args for scripts
Signed-off-by: Yakov Goldberg <yakov.g@samsung.com>
-rw-r--r--README14
-rwxr-xr-xbin/eo_graph_gen.py50
-rwxr-xr-xbin/eo_js_gen.py44
-rwxr-xr-xbin/eo_py_gen.py39
-rwxr-xr-xbin/eo_xml_gen.py31
-rw-r--r--eoparser/helper.py2
-rw-r--r--examples/evas_elem_test.py1
-rw-r--r--examples/evas_test2.py2
8 files changed, 57 insertions, 126 deletions
diff --git a/README b/README
index 1d481c7..ef0ef77 100644
--- a/README
+++ b/README
@@ -63,8 +63,7 @@ EO Introspection
> python setup.py install
--prefix option can be used, to install package into user's dir.
- PYTHONPATH env_var must be provided.
-
+ Add install_dir into PYTHONPATH.
1.3 To compile Cython files, cython (0.17) is required.
@@ -75,14 +74,13 @@ EO Introspection
or upgrade:
> pip install --upgrade cython
-
#####################################################
2. Introspecting folder and building class graph:
2.1 Folder introspection
Scanner runs recursively on defined folders
- > python eo_xml_gen.py --dir=IN_DIR --dir=IN_DIR2 --outdir=OUT_DIR -include=INCLUDE_DIR
+ > eo_xml_gen.py --dir=IN_DIR --dir=IN_DIR2 --outdir=OUT_DIR
script searches for dependencies in Python env paths.
If dependencies are not in Python search path,
--xmldir=XML_DIR can be needed
@@ -94,7 +92,7 @@ EO Introspection
# > python eo_graph_gen.py --dir=FOLDER_WITH_XML1 --dir=FOLDER_WITH_XMLS --outfile=OUTFILE.dot
# > dot -Tpng OUTFILE.dot -o out.png
# > eog out.png
- > python eo_graph_gen.py --dir=FOLDER_WITH_XML1
+ > eo_graph_gen.py --dir=FOLDER_WITH_XML1
--dir=FOLDER_WITH_XMLS --outfile=graph.png
> eog graph.png
@@ -103,7 +101,7 @@ EO Introspection
3. Generating python bindings
3.1 Generating python module for classes defined in XMLs:
- > python eo_py_gen.py --dir=XML_FOLDER --outdir=OUTDIR
+ > eo_py_gen.py --dir=XML_FOLDER --outdir=OUTDIR
--pkg="lib1 lib2" --module=MODULE_NAME --xmldir=INCLUDE_XML_DIR
-lname -I/include -DSOME_VAR=1
@@ -182,13 +180,13 @@ EO Introspection
According to layout, package 'eorepo' will be installed into
installation path.
- And it can be used as following:
+ It can be used as following:
from eorepo.eobase import EoBase
#####################################################################
4. Generating js module for classes defined in XMLs:
- a. > python eo_js_gen.py --dir=XML_FOLDER --outdir=OUTDIR
+ a. > eo_js_gen.py --dir=XML_FOLDER --outdir=OUTDIR
--module=MODULE_NAME --xmldir=INCLUDE_XML_DIR -lname -I/include
-DSOME_PATH=\"/path\"
diff --git a/bin/eo_graph_gen.py b/bin/eo_graph_gen.py
index 3d3305d..d7b2342 100755
--- a/bin/eo_graph_gen.py
+++ b/bin/eo_graph_gen.py
@@ -3,7 +3,7 @@
from eoparser.helper import isXML, dir_files_get, abs_path_get
from eoparser.xmlparser import XMLparser
from argparse import ArgumentParser
-import os
+import os, sys
def verbose_true(mes):
print mes
@@ -14,14 +14,14 @@ def verbose_false(mes):
def main():
parser = ArgumentParser()
parser.add_argument("-d", "--dir", dest="directory",
- action="append", help="Source files directory")
+ action="append", help="Path to XML descriptions", required=True)
parser.add_argument("-o", "--outfile", dest="outfile",
- action="store", help="Path for output files")
+ action="store", help="Out file in png format. Default: \"out.png\"", default="out.png")
parser.add_argument("-v", "--verbose",
action="store_true", dest="verbose", default=False,
- help="Print status messages to stdout")
+ help="Verbose output")
"""
parser.add_argument("--graphstyle", action="store", dest="graphstyle", default="digraph",
help="Set graph style. Default: \"digraph\"")
@@ -48,7 +48,6 @@ def main():
parser.add_argument("--long-names", action="store", dest="short_long", default="short",
help="Node shape.[\"short\", \"long\"] Default: \"short\"")
-
styles = {}
args = parser.parse_args()
@@ -99,33 +98,18 @@ def main():
else:
verbose_print = verbose_false
- verbose_print("Options: %s"%args)
+ directories = args.directory + sys.path
+ directories = abs_path_get(directories, False)
- directories = []
- outfile = ""
+ outfile = args.outfile
+ outfile = os.path.expanduser(outfile)
+ outfile = os.path.abspath(outfile)
- if args.directory == None:
- print "ERROR: no source directory was provided"
- exit(1)
- elif args.outfile == None:
- print "ERROR: no output file was provided"
+ outdir = os.path.split(outfile)[0]
+ if not os.path.exists(outdir):
+ print "ERROR: output directory %s doesn't exists... Aborting..."%outdir
exit(1)
- else:
- directories = abs_path_get(args.directory)
-
- outfile = args.outfile
- outfile = os.path.expanduser(outfile)
- outfile = os.path.abspath(outfile)
-
- outdir = os.path.split(outfile)[0]
- if not os.path.exists(outdir):
- print "ERROR: output directory %s doesn't exists... Aborting..."%outdir
- exit(1)
-
- verbose_print("Dirs: %s"%directories)
- verbose_print("Outfile: %s"%outfile)
-
xml_files = dir_files_get(directories)
xml_files = filter(isXML, xml_files)
@@ -194,11 +178,11 @@ def main():
verbose_print("Dot file: '%s' was generated"%(tmp_dot_file))
verbose_print("Graph file: '%s was generated"%(outfile))
os.system("dot -Tpng %s -o %s"%(tmp_dot_file, outfile))
- os.system("neato -Tpng %s -o %s_neato"%(tmp_dot_file, outfile))
- os.system("twopi -Tpng %s -o %s_twopi"%(tmp_dot_file, outfile))
- os.system("circo -Tpng %s -o %s_circo"%(tmp_dot_file, outfile))
- os.system("fdp -Tpng %s -o %s_fdp"%(tmp_dot_file, outfile))
- os.system("sfdp -Tpng %s -o %s_sfdp"%(tmp_dot_file, outfile))
+ #os.system("neato -Tpng %s -o %s_neato"%(tmp_dot_file, outfile))
+ #os.system("twopi -Tpng %s -o %s_twopi"%(tmp_dot_file, outfile))
+ #os.system("circo -Tpng %s -o %s_circo"%(tmp_dot_file, outfile))
+ #os.system("fdp -Tpng %s -o %s_fdp"%(tmp_dot_file, outfile))
+ #os.system("sfdp -Tpng %s -o %s_sfdp"%(tmp_dot_file, outfile))
if __name__ == "__main__":
main()
diff --git a/bin/eo_js_gen.py b/bin/eo_js_gen.py
index 7855ceb..b7d0b1f 100755
--- a/bin/eo_js_gen.py
+++ b/bin/eo_js_gen.py
@@ -19,7 +19,8 @@ def makefile_file_generate(args, c_files, outdir):
module_name = args.module
pkg = args.pkg
incl_paths = ["."]
- incl_paths += args.include_paths
+ if args.include_paths is not None:
+ incl_paths += args.include_paths
libs = args.libraries
lib_paths = args.library_paths
cpp_defines = args.cpp_defines
@@ -98,29 +99,26 @@ def makefile_file_generate(args, c_files, outdir):
f.write(l + "\n")
f.close()
-
-
-
def main():
parser = ArgumentParser()
parser.add_argument("-d", "--dir", dest="directory",
- action="append", help="Source files")
+ action="append", help="Path to XML descriptions", required=True)
parser.add_argument("-o", "--outdir", dest="outdir",
- action="store", help="Output directory")
+ action="store", help="Output directory", required=True)
parser.add_argument("-v", "--verbose",
action="store_true", dest="verbose", default=False,
- help="Print status messages to stdout. Default: False")
+ help="Verbose output")
parser.add_argument("-X", "--xmldir", dest="xmldir", default=sys.path,
- action="append", help="Include eobase directory")
+ action="append", help="Directory to search for parent classes's XMLs")
- parser.add_argument("--pkg", dest="pkg", default = "elementary eo",
- action="store", help="pkg-confing libraries. Default: \"elementary eo\"")
+ parser.add_argument("--pkg", dest="pkg", default = "eo",
+ action="store", help="pkg-confing libraries. Default: \"eo\"")
parser.add_argument("-m", "--module", dest="module",
- action="store", help="Name of module to generate")
+ action="store", help="Name of module", required=True)
parser.add_argument("-I", "--include", dest="include_paths",
action="append", help="Pre-processor include path")
@@ -138,35 +136,19 @@ def main():
args = parser.parse_args()
verbose_print = verbose_true if args.verbose is True else verbose_false
- verbose_print("Options: %s"%args)
directories = []
outdir = ""
sourcedir = ""
incl_dirs = []
- if args.directory == None:
- print "ERROR: No source directory was provided"
- exit(1)
- elif args.outdir == None:
- print "ERROR: No out directory was provided"
- exit(1)
- elif args.module == None:
- print "ERROR: No module name was provided"
- exit(1)
- else:
- directories = abs_path_get(args.directory)
- outdir = abs_path_get([args.outdir])[0]
- if args.xmldir is not None:
- incl_dirs = abs_path_get(args.xmldir, False)
-
- verbose_print("Dirs: %s"%directories)
- verbose_print("Outdir: %s"%outdir)
- verbose_print("Include dirs: %s"%incl_dirs)
+ directories = abs_path_get(args.directory)
+ outdir = abs_path_get([args.outdir])[0]
+ if args.xmldir is not None:
+ incl_dirs = abs_path_get(args.xmldir, False)
xml_files = dir_files_get(directories, False)
xml_files = filter(isXML, xml_files)
- verbose_print("In Files: %s"%xml_files)
xp = XMLparser()
xp.module_parse(args.module, xml_files, incl_dirs)
diff --git a/bin/eo_py_gen.py b/bin/eo_py_gen.py
index e43e4a9..1874584 100755
--- a/bin/eo_py_gen.py
+++ b/bin/eo_py_gen.py
@@ -50,7 +50,6 @@ def setup_file_generate(args, outdir):
lines.append("(e_compile_args, e_link_args) = pkgconfig(\"%s\")"%pkg)
lines.append("")
-
if cpp_defines is not None:
for d in cpp_defines:
lines.append("e_compile_args.append(\"-D%s\")"%d)
@@ -109,23 +108,23 @@ def setup_file_generate(args, outdir):
def main():
parser = ArgumentParser()
parser.add_argument("-d", "--dir", dest="directory",
- action="append", help="Source files")
+ action="append", help="Path to XML descriptions", required=True)
parser.add_argument("-o", "--outdir", dest="outdir",
- action="store", help="Output directory")
+ action="store", help="Output directory", required=True)
parser.add_argument("-v", "--verbose",
action="store_true", dest="verbose", default=False,
- help="Print status messages to stdout. Default: False")
+ help="Verbose output")
parser.add_argument("-X", "--xmldir", dest="xmldir", default=sys.path,
- action="append", help="Include eobase directory")
+ action="append", help="Directory to search for parent classes's XMLs")
parser.add_argument("--pkg", dest="pkg", default = "eo",
action="store", help="pkg-confing libraries. Default: \"eo\"")
parser.add_argument("-m", "--module", dest="module",
- action="store", help="Name of module to generate")
+ action="store", help="Name of module", required=True)
parser.add_argument("-I", "--include", dest="include_paths",
action="append", help="Pre-processor include path")
@@ -143,41 +142,22 @@ def main():
verbose_print = verbose_true if args.verbose is True else verbose_false
- verbose_print("Options: %s"%args)
-
directories = []
outdir = ""
sourcedir = ""
incl_dirs = []
- if args.directory == None:
- print "ERROR: No source directory was provided"
- exit(1)
- elif args.outdir == None:
- print "ERROR: No out directory was provided"
- exit(1)
- elif args.module == None:
- print "ERROR: No module name was provided"
- exit(1)
- else:
- directories = abs_path_get(args.directory)
- outdir = abs_path_get([args.outdir])[0]
- if args.xmldir is not None:
- incl_dirs = abs_path_get(args.xmldir, False)
-
-
- verbose_print("Dirs: %s"%directories)
- verbose_print("Outdir: %s"%outdir)
- verbose_print("Include dirs: %s"%incl_dirs)
+ directories = abs_path_get(args.directory)
+ outdir = abs_path_get([args.outdir])[0]
+ if args.xmldir is not None:
+ incl_dirs = abs_path_get(args.xmldir, False)
xml_files = dir_files_get(directories, False)
xml_files = filter(isXML, xml_files)
- verbose_print("In Files: %s"%xml_files)
xp = XMLparser()
xp.module_parse(args.module, xml_files, incl_dirs)
-
if args.module == "eobase":
outdir_tmp = os.path.join(outdir, const.PREFIX)
if not os.path.exists(outdir_tmp):
@@ -192,7 +172,6 @@ def main():
if args.module == "eobase":
for d in incl_dirs:
d_tmp = os.path.join(d, "eodefault.pxd")
- #print "dir: ", d_tmp
if os.path.exists(d_tmp):
sourcedir = d
break
diff --git a/bin/eo_xml_gen.py b/bin/eo_xml_gen.py
index 5e5f26b..cfbd298 100755
--- a/bin/eo_xml_gen.py
+++ b/bin/eo_xml_gen.py
@@ -19,20 +19,20 @@ def main():
parser = ArgumentParser()
parser.add_argument("-d", "--dir", dest="directory",
- action="append", help="source files")
+ action="append", help="Source C-files to introspect", required=True)
parser.add_argument("-o", "--outdir", dest="outdir",
- action="store", help="output directory")
+ action="store", help="Output directory", required=True)
parser.add_argument("-t", "--typedefs", dest="typedefs",
action="store", help="Additional typedefs for parser")
parser.add_argument("-X", "--xmldir", dest="xmldir", default = sys.path,
- action="append", help="Include xml directory")
+ action="append", help="Directory to search for parent classes's XMLs")
parser.add_argument("-v", "--verbose",
action="store_true", dest="verbose", default=False,
- help="print status messages to stdout")
+ help="Verbose output")
args = parser.parse_args()
verbose_print = None
@@ -47,25 +47,15 @@ def main():
typedefs = ""
xmldir = []
- if args.directory == None:
- print "No source directory was provided"
- exit(1)
- elif args.outdir == None:
- print "No out directory was provided"
- exit(1)
- else:
- directories = abs_path_get(args.directory)
- if args.xmldir is not None:
- xmldir = abs_path_get(args.xmldir, False)# not abort if dir doesn't exist
+ directories = abs_path_get(args.directory)
+ outdir = abs_path_get([args.outdir])[0]
- outdir = abs_path_get([args.outdir])[0]
+ if args.xmldir is not None:
+ xmldir = abs_path_get(args.xmldir, False)# not abort if dir doesn't exist
if args.typedefs != None:
typedefs = abs_path_get([args.typedefs])[0]
- verbose_print("dirs %s"%directories)
- verbose_print("outdir %s"%outdir)
-
files = dir_files_get(directories)
c_files = filter(isC, files)
h_files = filter(isH, files)
@@ -86,7 +76,6 @@ def main():
for f in h_files:
cp.h_file_data_get(f)
-
#remove records, which are not class, t.e. they don't have GET_FUNCTION key
cl_data_tmp = dict(cp.cl_data) #deep copy of dictionary
for k in cl_data_tmp:
@@ -109,8 +98,6 @@ def main():
cl_data_tmp2 = dict(cp.cl_data)
parents_to_find = filter(lambda ll: True if ll not in cl_data_tmp2 else False, list_of_parents)
- verbose_print("parents_to_find: %s"%parents_to_find)
-
#if we have parents to find
if len(parents_to_find) != 0:
if len(xmldir) == 0:
@@ -123,7 +110,6 @@ def main():
if len(xml_files) == 0:
print "ERROR: no include files found for %s classes... Aborting..."% ",".join(parents_to_find)
exit(1)
- verbose_print("xml_files: %s\n"%xml_files)
#parsing include XMLs
xp = XMLparser()
@@ -139,7 +125,6 @@ def main():
parents_to_find.pop(i)
del xp
-
#if there are still parents, which we need to find - exit
if len(parents_to_find) != 0:
print "ERROR: XML files weren't found for %s classes... Aborting"%(",".join(parents_to_find))
diff --git a/eoparser/helper.py b/eoparser/helper.py
index 5ea7523..18cf703 100644
--- a/eoparser/helper.py
+++ b/eoparser/helper.py
@@ -152,6 +152,8 @@ def abs_path_get(_paths, _warning = True):
if _warning:
print "ERROR: path %s doesn't exist... Aborting..."%path_tmp
exit(1)
+ else:
+ print "Warning: path %s doesn't exist..."%path_tmp
return res
diff --git a/examples/evas_elem_test.py b/examples/evas_elem_test.py
index a04f1b0..62d1a14 100644
--- a/examples/evas_elem_test.py
+++ b/examples/evas_elem_test.py
@@ -37,6 +37,7 @@ box.elm_obj_box_pack_end(but)
but.evas_obj_visibility_set(1)
but.evas_obj_color_set(255, 255, 0, 255)
but.elm_wdg_text_part_set(None, "Button")
+but.evas_obj_size_set(100, 30)
d = w1.elm_obj_win_screen_dpi_get()
print d
diff --git a/examples/evas_test2.py b/examples/evas_test2.py
index 4e6f766..900f2da 100644
--- a/examples/evas_test2.py
+++ b/examples/evas_test2.py
@@ -137,9 +137,9 @@ print type(w)
ba = ElwButton(w);
ba.exevas_obj_visibility_set(1)
ba.exevas_obj_position_set(30, 100)
+ba.elw_button_text_set("(B) ADD cb")
ba.exevas_obj_size_set(100, 50)
ba.exevas_obj_color_set(255, 0, 255, 255)
-ba.elw_button_text_set("(B) ADD cb")