scons: deal with generated .py files properly
This commit is contained in:
parent
8a4af3668d
commit
374d337693
1 changed files with 7 additions and 7 deletions
|
@ -132,15 +132,15 @@ class PySource(SourceFile):
|
||||||
modpath = '.'.join(modpath)
|
modpath = '.'.join(modpath)
|
||||||
|
|
||||||
arcpath = path + [ self.basename ]
|
arcpath = path + [ self.basename ]
|
||||||
debugname = self.snode.abspath
|
abspath = self.snode.abspath
|
||||||
if not exists(debugname):
|
if not exists(abspath):
|
||||||
debugname = self.tnode.abspath
|
abspath = self.tnode.abspath
|
||||||
|
|
||||||
self.package = package
|
self.package = package
|
||||||
self.modname = modname
|
self.modname = modname
|
||||||
self.modpath = modpath
|
self.modpath = modpath
|
||||||
self.arcname = joinpath(*arcpath)
|
self.arcname = joinpath(*arcpath)
|
||||||
self.debugname = debugname
|
self.abspath = abspath
|
||||||
self.compiled = File(self.filename + 'c')
|
self.compiled = File(self.filename + 'c')
|
||||||
self.assembly = File(self.filename + '.s')
|
self.assembly = File(self.filename + '.s')
|
||||||
self.symname = "PyEMB_" + PySource.invalid_sym_char.sub('_', modpath)
|
self.symname = "PyEMB_" + PySource.invalid_sym_char.sub('_', modpath)
|
||||||
|
@ -339,9 +339,9 @@ class DictImporter(object):
|
||||||
source = self.modules[fullname]
|
source = self.modules[fullname]
|
||||||
if source.modname == '__init__':
|
if source.modname == '__init__':
|
||||||
mod.__path__ = source.modpath
|
mod.__path__ = source.modpath
|
||||||
mod.__file__ = source.snode.abspath
|
mod.__file__ = source.abspath
|
||||||
|
|
||||||
exec file(source.snode.abspath, 'r') in mod.__dict__
|
exec file(source.abspath, 'r') in mod.__dict__
|
||||||
|
|
||||||
return mod
|
return mod
|
||||||
|
|
||||||
|
@ -892,7 +892,7 @@ def objectifyPyFile(target, source, env):
|
||||||
dst = file(str(target[0]), 'w')
|
dst = file(str(target[0]), 'w')
|
||||||
|
|
||||||
pysource = PySource.tnodes[source[0]]
|
pysource = PySource.tnodes[source[0]]
|
||||||
compiled = compile(src, pysource.debugname, 'exec')
|
compiled = compile(src, pysource.abspath, 'exec')
|
||||||
marshalled = marshal.dumps(compiled)
|
marshalled = marshal.dumps(compiled)
|
||||||
compressed = zlib.compress(marshalled)
|
compressed = zlib.compress(marshalled)
|
||||||
data = compressed
|
data = compressed
|
||||||
|
|
Loading…
Reference in a new issue