Use the waf 'copy' tool to copy __init__.py files

They had to be renamed to work around waf limitations.
This commit is contained in:
Gustavo J. A. M. Carneiro
2011-03-28 14:56:08 +01:00
parent 19ae044602
commit 38e2f863c9
3 changed files with 6 additions and 39 deletions

View File

@@ -603,25 +603,9 @@ def build(bld):
set_pybindgen_pythonpath(env)
# copy the __init__.py file to the build dir. waf can't handle
# this, it's against waf's principles to have build dir files
# with the same name as source dir files, apparently.
dirnode = bld.path.find_dir('ns')
src = os.path.join(dirnode.abspath(), '__init__.py')
dst = os.path.join(dirnode.abspath(env), '__init__.py')
try:
need_copy = os.stat(src).st_mtime > os.stat(dst).st_mtime
except OSError:
need_copy = True
if need_copy:
try:
os.mkdir(os.path.dirname(dst))
except OSError:
pass
print "%r -> %r" % (src, dst)
shutil.copy2(src, dst)
bld.new_task_gen(features='copy',
source="ns__init__.py",
target='ns/__init__.py')
if env['ENABLE_PYTHON_BINDINGS'] and env['BINDINGS_TYPE'] in ('monolithic', 'both'):
@@ -777,26 +761,9 @@ def build(bld):
pass
pymod.env['CXXDEFINES'] = defines
# copy the __init__.py file to the build dir. waf can't handle
# this, it's against waf's principles to have build dir files
# with the same name as source dir files, apparently.
dirnode = bld.path.find_dir('ns3')
src = os.path.join(dirnode.abspath(), '__init__.py')
dst = os.path.join(dirnode.abspath(env), '__init__.py')
try:
need_copy = os.stat(src).st_mtime > os.stat(dst).st_mtime
except OSError:
need_copy = True
if need_copy:
try:
os.mkdir(os.path.dirname(dst))
except OSError:
pass
print "%r -> %r" % (src, dst)
shutil.copy2(src, dst)
bld.new_task_gen(features='copy',
source="ns3__init__.py",
target='ns3/__init__.py')
if env['ENABLE_PYTHON_BINDINGS'] and env['BINDINGS_TYPE'] in ('modular',):
gen = gen_ns3_compat_pymod_task(bld, bld.path.find_or_declare("ns3.py").bldpath(bld.env))