aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-12-11 13:47:18 +0200
committerYakov Goldberg <yakov.g@samsung.com>2012-12-11 13:48:21 +0200
commit301f4ea677ca7eced80fac38dc0d7393de59a27b (patch)
tree2dcbd1e0e98451f3142e706d7afb1a48d8968888
parentCommand line options added to JS generator (diff)
downloadeo_bindings-301f4ea677ca7eced80fac38dc0d7393de59a27b.tar.gz
Command line options added for Py generator
-I to include search path for headers -L to include search path for libraries -l to include libs Signed-off-by: Yakov Goldberg <yakov.g@samsung.com>
-rw-r--r--eo_py/README2
-rwxr-xr-xeo_py/eo_py_gen.py46
2 files changed, 41 insertions, 7 deletions
diff --git a/eo_py/README b/eo_py/README
index e5698ae..96c7865 100644
--- a/eo_py/README
+++ b/eo_py/README
@@ -11,7 +11,7 @@ python module.
1. Generating python module for classes defined in XMLs:
a. > python eo_py_gen.py --dir=XML_FOLDER --outdir=OUTDIR --pkg="lib1 lib2"
- --module=MODULE_NAME --include=INCLUDE_DIR
+ --module=MODULE_NAME --xmldir=INCLUDE_XML_DIR -lname -I/include
In case if some class is needed (usually parent class, which is not in the tree being analyzed),
include XMLs are searched in python system paths.
If include file wasn't found, explicit --include=INCLUDE_DIR dir is needed
diff --git a/eo_py/eo_py_gen.py b/eo_py/eo_py_gen.py
index 1dfad4f..bcb60be 100755
--- a/eo_py/eo_py_gen.py
+++ b/eo_py/eo_py_gen.py
@@ -12,7 +12,13 @@ def verbose_false(mes):
pass
-def setup_file_generate(module_name, pkg, outdir):
+def setup_file_generate(args, outdir):
+ module_name = args.module
+ pkg = args.pkg
+ incl_paths = args.include_paths
+ libs = args.libraries
+ lib_paths = args.library_paths
+
module_file = module_name + ".pyx"
lines = []
@@ -31,9 +37,28 @@ def setup_file_generate(module_name, pkg, outdir):
lines.append("(e_compile_args, e_link_args) = pkgconfig(\"%s\")"%pkg)
lines.append("")
- lines.append("e_include_dirs = [\".\"]")
- lines.append("e_library_dirs = []")
- lines.append("e_libraries = []")
+ include_dirs = ["\".\""]
+ if incl_paths is not None:
+ for i in incl_paths:
+ include_dirs.append("\"%s\""%i)
+ lines.append("e_include_dirs = [%s]"%', '.join(include_dirs))
+ del include_dirs
+
+ lib_dirs = []
+ if lib_paths is not None:
+ for i in lib_paths:
+ lib_dirs.append("\"%s\""%i)
+ lines.append("e_library_dirs = [%s]"%', '.join(lib_dirs))
+ del lib_dirs
+
+ lib_names = []
+ if libs is not None:
+ for i in libs:
+ lib_names.append("\"%s\""%i)
+ lines.append("e_libraries = [%s]"%', '.join(lib_names))
+ del lib_names
+
+
lines.append("")
lines.append("setup(")
@@ -66,7 +91,7 @@ def main():
action="store_true", dest="verbose", default=False,
help="Print status messages to stdout. Default: False")
- parser.add_argument("-i", "--include", dest="xmldir", default=sys.path,
+ parser.add_argument("-X", "--xmldir", dest="xmldir", default=sys.path,
action="append", help="Include eobase directory")
parser.add_argument("--pkg", dest="pkg", default = "eo",
@@ -75,6 +100,15 @@ def main():
parser.add_argument("-m", "--module", dest="module",
action="store", help="Name of module to generate")
+ parser.add_argument("-I", "--include", dest="include_paths",
+ action="append", help="Pre-processor include path")
+
+ parser.add_argument("-l", "--library", dest="libraries",
+ action="append", help="Libraries of this unit")
+
+ parser.add_argument("-L", "--library-path", dest="library_paths",
+ action="append", help="Directories to search for libraries")
+
args = parser.parse_args()
verbose_print = verbose_true if args.verbose is True else verbose_false
@@ -114,7 +148,7 @@ def main():
xp.module_parse(args.module, xml_files, incl_dirs)
xp.py_code_generate(args.module ,outdir)
- setup_file_generate(args.module, args.pkg, outdir)
+ setup_file_generate(args, outdir)
#Looking for "eodefault.pxd" module. Needed to include
for d in incl_dirs: