mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
codegen/: New --extendpath option for codegenerator so we can add extra path to search for included override files.
Original commit message from CVS: * codegen/codegen.py: * codegen/override.py: New --extendpath option for codegenerator so we can add extra path to search for included override files.
This commit is contained in:
parent
282abc30ff
commit
53e67e611a
3 changed files with 31 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2006-03-14 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* codegen/codegen.py:
|
||||
* codegen/override.py:
|
||||
New --extendpath option for codegenerator so we can add
|
||||
extra path to search for included override files.
|
||||
|
||||
2006-03-13 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* gst/Makefile.am:
|
||||
|
|
|
@ -1227,17 +1227,24 @@ def register_types(parser):
|
|||
|
||||
usage = 'usage: codegen.py [-o overridesfile] [-p prefix] defsfile'
|
||||
def main(argv):
|
||||
o = override.Overrides()
|
||||
prefix = 'pygtk'
|
||||
outfilename = None
|
||||
errorfilename = None
|
||||
opts, args = getopt.getopt(argv[1:], "o:p:r:t:D:",
|
||||
extendpath = []
|
||||
opts, args = getopt.getopt(argv[1:], "o:p:r:t:D:x",
|
||||
["override=", "prefix=", "register=", "outfilename=",
|
||||
"load-types=", "errorfilename="])
|
||||
"load-types=", "errorfilename=", "extendpath="])
|
||||
defines = {} # -Dkey[=val] options
|
||||
|
||||
for opt, arg in opts:
|
||||
if opt in ('-x', '--extendpath'):
|
||||
extendpath.append(arg)
|
||||
extendpath.insert(0, os.getcwd())
|
||||
o = override.Overrides(path=extendpath)
|
||||
|
||||
for opt, arg in opts:
|
||||
if opt in ('-o', '--override'):
|
||||
o = override.Overrides(arg)
|
||||
o = override.Overrides(arg, path=extendpath)
|
||||
elif opt in ('-p', '--prefix'):
|
||||
prefix = arg
|
||||
elif opt in ('-r', '--register'):
|
||||
|
|
|
@ -22,7 +22,7 @@ def class2cname(klass, method):
|
|||
import_pat = re.compile(r'\s*import\s+(\S+)\.([^\s.]+)\s+as\s+(\S+)')
|
||||
|
||||
class Overrides:
|
||||
def __init__(self, filename=None):
|
||||
def __init__(self, filename=None, path=[]):
|
||||
self.modulename = None
|
||||
self.ignores = {}
|
||||
self.glob_ignores = []
|
||||
|
@ -38,13 +38,24 @@ class Overrides:
|
|||
self.imports = []
|
||||
self.defines = {}
|
||||
self.functions = {}
|
||||
self.path = path
|
||||
if filename:
|
||||
self.handle_file(filename)
|
||||
|
||||
def handle_file(self, filename):
|
||||
oldpath = os.getcwd()
|
||||
|
||||
fp = None
|
||||
for path in self.path:
|
||||
os.chdir(oldpath)
|
||||
os.chdir(os.path.abspath(path))
|
||||
try:
|
||||
fp = open(filename, 'r')
|
||||
except:
|
||||
continue
|
||||
if not fp:
|
||||
raise Exception, "Couldn't find file %s" % filename
|
||||
|
||||
fp = open(filename, 'r')
|
||||
dirname = os.path.dirname(os.path.abspath(filename))
|
||||
|
||||
if dirname != oldpath:
|
||||
|
|
Loading…
Reference in a new issue