build.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:ardy 作者: avara1986 项目源码 文件源码
def _install_packages(self, path, packages):
        """Install all packages listed to the target directory.
        Ignores any package that includes Python itself and python-lambda as well
        since its only needed for deploying and not running the code
        :param str path:
            Path to copy installed pip packages to.
        :param list packages:
            A list of packages to be installed via pip.
        """

        def _filter_blacklist(package):
            blacklist = ["-i", "#", "Python==", "ardy=="]
            return all(package.startswith(entry.encode()) is False for entry in blacklist)

        filtered_packages = filter(_filter_blacklist, packages)
        # print([package for package in filtered_packages])
        for package in filtered_packages:
            if package.startswith(b'-e '):
                package = package.replace('-e ', '')

            logger.info('Installing {package}'.format(package=package))
            pip.main(['install', package, '-t', path, '--ignore-installed', '-q'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号