def get_pyextension_imports(modname):
 statement = ("\n        import sys\n        # Importing distutils filters common modules, especially in virtualenv.\n        import distutils\n        original_modlist = set(sys.modules.keys())\n        # When importing this module - sys.modules gets updated.\n        import %(modname)s\n        all_modlist = set(sys.modules.keys())\n        diff = all_modlist - original_modlist\n        # Module list contain original modname. We do not need it there.\n        diff.discard('%(modname)s')\n        # Print module list to stdout.\n        print(list(diff))\n    " % {'modname': modname})
 module_imports = eval_statement(statement)
 if (not module_imports):
  logger.error(('Cannot find imports for module %s' % modname))
  return []
 return module_imports

def get_pyextension_imports ( modname ) : statement = ( "\n        import sys\n        # Importing distutils filters common modules, especially in virtualenv.\n        import distutils\n        original_modlist = set(sys.modules.keys())\n        # When importing this module - sys.modules gets updated.\n        import %(modname)s\n        all_modlist = set(sys.modules.keys())\n        diff = all_modlist - original_modlist\n        # Module list contain original modname. We do not need it there.\n        diff.discard('%(modname)s')\n        # Print module list to stdout.\n        print(list(diff))\n    " % { 'modname' : modname } ) module_imports = eval_statement ( statement ) if ( not module_imports ) : logger . error ( ( 'Cannot find imports for module %s' % modname ) ) return [ ] return module_imports
return list of modules required by binary python extension .