diff options
| author | William Deegan <bill@baddogconsulting.com> | 2009-11-14 00:47:32 (GMT) |
|---|---|---|
| committer | William Deegan <bill@baddogconsulting.com> | 2009-11-14 00:47:32 (GMT) |
| commit | ca3cc471901662062924e0f61a052a39fb5709ff (patch) | |
| tree | d2e4e38d3f44c39281bba6f4032e760eafc51f5b /src/engine/SCons | |
| parent | de49eaa521884deab59dc642b772a9d3af133df1 (diff) | |
| download | SCons-ca3cc471901662062924e0f61a052a39fb5709ff.zip SCons-ca3cc471901662062924e0f61a052a39fb5709ff.tar.gz SCons-ca3cc471901662062924e0f61a052a39fb5709ff.tar.bz2 | |
Fix bug 1944 - handle non-existant .i files when swig emitter is called. Make an educated guess on the generated module name based on the .i file name.
Diffstat (limited to 'src/engine/SCons')
| -rw-r--r-- | src/engine/SCons/Tool/swig.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index 92c93de..d8d032c 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -63,7 +63,13 @@ def _find_modules(src): case.)""" directors = 0 mnames = [] - matches = _reModule.findall(open(src).read()) + try: + matches = _reModule.findall(open(src).read()) + except IOError: + # If the file's not yet generated, guess the module name from the filename + matches = [] + mnames += [os.path.splitext(src)[0]] + for m in matches: mnames.append(m[2]) directors = directors or string.find(m[0], 'directors') >= 0 @@ -96,12 +102,12 @@ def _swigEmitter(target, source, env): # .py files should be generated in SWIGOUTDIR if specified, # otherwise in the same directory as the target if outdir: - python_files = map(lambda j, o=outdir, e=env: - e.fs.File(os.path.join(o, j)), - python_files) + python_files = map(lambda j, o=outdir, e=env: + e.fs.File(os.path.join(o, j)), + python_files) else: python_files = map(lambda m, d=target[0].dir: - d.File(m), python_files) + d.File(m), python_files) target.extend(python_files) if "-java" in flags: if mnames is None: |
