website.py 文件源码

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

项目:hatch 作者: hatch-sh 项目源码 文件源码
def _upload_artifacts(self, bucket):
        mimetypes.add_type('application/json', '.map')
        mimetypes.add_type('application/woff2', '.woff2')
        for artifact in recursive_glob(self.config.path, '*'):
            mime_type = mimetypes.guess_type(artifact)

            if mime_type is None:
                logger.error('Unknown mime type for %s', artifact)
                sys.exit(1)

            [content_type, _] = mime_type

            if content_type is None:
                logger.error('Unknown content-type for %s', artifact)
                sys.exit(1)

            logger.debug('Uploading %s [%s]', artifact, content_type)
            file_path = artifact.replace('{}/'.format(self.config.path), '')
            bucket.upload_file(artifact, file_path, ExtraArgs={
                'ACL': 'public-read',
                'CacheControl': 'public, max-age=31536000, no-cache',
                'ContentType': content_type
            })
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号