Handle the case where scratch or examples directory is missing
This commit is contained in:
52
wscript
52
wscript
@@ -624,32 +624,38 @@ def register_ns3_script(bld, name, dependencies=('core',)):
|
||||
def add_examples_programs(bld):
|
||||
env = bld.env
|
||||
if env['ENABLE_EXAMPLES']:
|
||||
for dir in os.listdir('examples'):
|
||||
if dir.startswith('.') or dir == 'CVS':
|
||||
continue
|
||||
if os.path.isdir(os.path.join('examples', dir)):
|
||||
bld.recurse(os.path.join('examples', dir))
|
||||
try:
|
||||
for dir in os.listdir('examples'):
|
||||
if dir.startswith('.') or dir == 'CVS':
|
||||
continue
|
||||
if os.path.isdir(os.path.join('examples', dir)):
|
||||
bld.recurse(os.path.join('examples', dir))
|
||||
except OSError:
|
||||
return
|
||||
|
||||
def add_scratch_programs(bld):
|
||||
all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']]
|
||||
for filename in os.listdir("scratch"):
|
||||
if filename.startswith('.') or filename == 'CVS':
|
||||
continue
|
||||
if os.path.isdir(os.path.join("scratch", filename)):
|
||||
obj = bld.create_ns3_program(filename, all_modules)
|
||||
obj.path = obj.path.find_dir('scratch').find_dir(filename)
|
||||
obj.source = obj.path.ant_glob('*.cc')
|
||||
obj.target = filename
|
||||
obj.name = obj.target
|
||||
obj.install_path = None
|
||||
elif filename.endswith(".cc"):
|
||||
name = filename[:-len(".cc")]
|
||||
obj = bld.create_ns3_program(name, all_modules)
|
||||
obj.path = obj.path.find_dir('scratch')
|
||||
obj.source = filename
|
||||
obj.target = name
|
||||
obj.name = obj.target
|
||||
obj.install_path = None
|
||||
try:
|
||||
for filename in os.listdir("scratch"):
|
||||
if filename.startswith('.') or filename == 'CVS':
|
||||
continue
|
||||
if os.path.isdir(os.path.join("scratch", filename)):
|
||||
obj = bld.create_ns3_program(filename, all_modules)
|
||||
obj.path = obj.path.find_dir('scratch').find_dir(filename)
|
||||
obj.source = obj.path.ant_glob('*.cc')
|
||||
obj.target = filename
|
||||
obj.name = obj.target
|
||||
obj.install_path = None
|
||||
elif filename.endswith(".cc"):
|
||||
name = filename[:-len(".cc")]
|
||||
obj = bld.create_ns3_program(name, all_modules)
|
||||
obj.path = obj.path.find_dir('scratch')
|
||||
obj.source = filename
|
||||
obj.target = name
|
||||
obj.name = obj.target
|
||||
obj.install_path = None
|
||||
except OSError:
|
||||
return
|
||||
|
||||
def _get_all_task_gen(self):
|
||||
for group in self.groups:
|
||||
|
||||
Reference in New Issue
Block a user