def add_project_to_sys_path(self):
from pkg_resources import normalize_path, add_activation_listener
from pkg_resources import working_set, require
self.reinitialize_command('egg_info')
self.run_command('egg_info')
self.reinitialize_command('build_ext', inplace=1)
self.run_command('build_ext')
self.__old_path = sys.path[:]
self.__old_modules = sys.modules.copy()
if 'PyObjCTools' in sys.modules:
del sys.modules['PyObjCTools']
ei_cmd = self.get_finalized_command('egg_info')
sys.path.insert(0, normalize_path(ei_cmd.egg_base))
sys.path.insert(1, os.path.dirname(__file__))
add_activation_listener(lambda dist: dist.activate())
working_set.__init__()
require('%s==%s'%(ei_cmd.egg_name, ei_cmd.egg_version))
评论列表
文章目录