[vlc-commits] Move generator code and test module to subdirs

Olivier Aubert git at videolan.org
Thu Nov 5 23:55:13 CET 2015


vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Thu Nov  5 23:41:49 2015 +0100| [3edec464912b1de7d583cfefb5c457021caf7571] | committer: Olivier Aubert

Move generator code and test module to subdirs

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=3edec464912b1de7d583cfefb5c457021caf7571
---

 Makefile                                           |    8 ++++----
 generated/vlc.py                                   |    2 +-
 LibVlc-footer.java => generator/LibVlc-footer.java |    0
 LibVlc-header.java => generator/LibVlc-header.java |    0
 boilerplate.java => generator/boilerplate.java     |    0
 footer.py => generator/footer.py                   |    0
 generate.py => generator/generate.py               |   16 +++++++++-------
 header.py => generator/header.py                   |    0
 override.py => generator/override.py               |    0
 test.py => tests/test.py                           |    0
 10 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index f972e50..0d4f466 100644
--- a/Makefile
+++ b/Makefile
@@ -2,17 +2,17 @@ MODULE_NAME=generated/vlc.py
 
 all: $(MODULE_NAME)
 
-$(MODULE_NAME): generate.py header.py footer.py override.py ../../include/vlc/*.h
-	python generate.py ../../include/vlc/*.h -o $@
+$(MODULE_NAME): generator/generate.py generator/header.py generator/footer.py generator/override.py ../../include/vlc/*.h
+	python generator/generate.py ../../include/vlc/*.h -o $@
 
 doc: $(MODULE_NAME)
 	-epydoc -v -o doc $<
 
 test: $(MODULE_NAME)
-	PYTHONPATH=generated python test.py
+	PYTHONPATH=generated python tests/test.py
 
 test3: $(MODULE_NAME)
-	PYTHONPATH=generated python3 test.py
+	PYTHONPATH=generated python3 tests/test.py
 
 tests: test test3
 
diff --git a/generated/vlc.py b/generated/vlc.py
old mode 100755
new mode 100644
index 4065825..ae8da48
--- a/generated/vlc.py
+++ b/generated/vlc.py
@@ -49,7 +49,7 @@ import functools
 from inspect import getargspec
 
 __version__ = "N/A"
-build_date  = "Wed Sep 30 15:51:48 2015"
+build_date  = "Thu Nov  5 23:41:43 2015"
 
 # The libvlc doc states that filenames are expected to be in UTF8, do
 # not rely on sys.getfilesystemencoding() which will be confused,
diff --git a/LibVlc-footer.java b/generator/LibVlc-footer.java
similarity index 100%
rename from LibVlc-footer.java
rename to generator/LibVlc-footer.java
diff --git a/LibVlc-header.java b/generator/LibVlc-header.java
similarity index 100%
rename from LibVlc-header.java
rename to generator/LibVlc-header.java
diff --git a/boilerplate.java b/generator/boilerplate.java
similarity index 100%
rename from boilerplate.java
rename to generator/boilerplate.java
diff --git a/footer.py b/generator/footer.py
similarity index 100%
rename from footer.py
rename to generator/footer.py
diff --git a/generate.py b/generator/generate.py
similarity index 98%
rename from generate.py
rename to generator/generate.py
index e7230ed..38f111c 100755
--- a/generate.py
+++ b/generator/generate.py
@@ -61,6 +61,8 @@ import re
 import time
 import operator
 
+BASEDIR = os.path.abspath(os.path.dirname(sys.argv[0]))
+
 # Opener for text files
 if sys.hexversion < 0x3000000:
     def opener(name, mode='r'):
@@ -1040,7 +1042,7 @@ class _Enum(ctypes.c_uint):
         def striprefix(name):
             return name.replace(x, '').replace('libvlc_', '')
 
-        codes, methods, docstrs = self.parse_override('override.py')
+        codes, methods, docstrs = self.parse_override(os.path.join(BASEDIR, 'override.py'))
 
         # sort functions on the type/class
         # of their first parameter
@@ -1158,14 +1160,14 @@ class _Enum(ctypes.c_uint):
         """Write Python bindings to a file or C{stdout}.
         """
         self.outopen(path or '-')
-        self.insert_code('header.py', genums=True)
+        self.insert_code(os.path.join(BASEDIR, 'header.py'), genums=True)
 
         self.generate_wrappers()
         self.generate_ctypes()
 
         self.unwrapped()
 
-        self.insert_code('footer.py')
+        self.insert_code(os.path.join(BASEDIR, 'footer.py'))
         self.outclose()
 
 
@@ -1228,7 +1230,7 @@ class JavaGenerator(_Generator):
             j = self.class4(e.name)
             self.outopen(j + '.java')
 
-            self.insert_code('boilerplate.java')
+            self.insert_code(os.path.join(BASEDIR, 'boilerplate.java'))
             self.output("""package org.videolan.jvlc.internal;
 
 public enum %s
@@ -1258,8 +1260,8 @@ public enum %s
         """
         self.outopen('LibVlc.java')
 
-        self.insert_code('boilerplate.java')
-        self.insert_code('LibVlc-header.java')
+        self.insert_code(os.path.join(BASEDIR, 'boilerplate.java'))
+        self.insert_code(os.path.join(BASEDIR, 'LibVlc-header.java'))
 
         self.generate_header()
         for f in self.parser.funcs:
@@ -1267,7 +1269,7 @@ public enum %s
             p =    ', '.join('%s %s' % (self.class4(p.type), p.name) for p in f.pars)
             self.output('%s %s(%s);' % (self.class4(f.type), f.name, p), nt=2)
 
-        self.insert_code('LibVlc-footer.java')
+        self.insert_code(os.path.join(BASEDIR, 'LibVlc-footer.java'))
 
         self.unwrapped()
         self.outclose()
diff --git a/header.py b/generator/header.py
similarity index 100%
rename from header.py
rename to generator/header.py
diff --git a/override.py b/generator/override.py
similarity index 100%
rename from override.py
rename to generator/override.py
diff --git a/test.py b/tests/test.py
similarity index 100%
rename from test.py
rename to tests/test.py



More information about the vlc-commits mailing list