aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-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
4 files changed, 47 insertions, 117 deletions
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))