+if len(sys.argv) > 1:
+ # explicit rule file list
+ rules_files = sys.argv[1:]
+else:
+ # take them from the build dir
+ root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ rules_dir = os.path.join(os.environ.get('top_srcdir', root_dir), 'rules')
+ if not os.path.isdir(rules_dir):
+ sys.stderr.write('No rules files given, and %s does not exist, aborting' % rules_dir)
+ sys.exit(2)
+ rules_files = glob(os.path.join(rules_dir, '*.rules'))