# /* # * This program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License version 2 as # * published by the Free Software Foundation; # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRANTY; without even the implied warranty of # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # * GNU General Public License for more details. # * # * You should have received a copy of the GNU General Public License # * along with this program; if not, write to the Free Software # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # */ # Try to import all ns-3 python modules for src/ directory, with exceptions # XXX TODO: find the list of available modules from the current build # directory; requires finding the waf 'out_dir' and finding # all modules built in 'out_dir'/bindings/python/ns from sys import exit from os import listdir, getcwd, environ from os.path import isdir, join module_except = ['brite', 'test', 'visualizer', 'openflow', 'click', 'netanim'] modules = [ d for d in listdir (join(getcwd(),'src')) if isdir(join(join(getcwd(),'src'),d)) ] print "Modules to test import:" print modules failed = [] for module in modules: if module in module_except: continue modulename = 'ns.' + module modulename = modulename.replace('-','_') try: exec "import %s" % modulename except ImportError as e: failed.append(module) if failed: print "Modules failed to import (may not be in the build):" print failed exit(1)