加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
_validate_init.py 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
Fanchao Meng (孟繁超) 提交于 2021-03-20 01:11 . first commit
"""
DO NOT MODIFY
This file is used to validate your publish settings.
"""
from __future__ import print_function
import os
import sys
import importlib
components_package = 'dash_echarts'
components_lib = importlib.import_module(components_package)
missing_dist_msg = 'Warning {} was not found in `{}.__init__.{}`!!!'
missing_manifest_msg = '''
Warning {} was not found in `MANIFEST.in`!
It will not be included in the build!
'''
with open('MANIFEST.in', 'r') as f:
manifest = f.read()
def check_dist(dist, filename):
# Support the dev bundle.
if filename.endswith('dev.js'):
return True
return any(
filename in x
for d in dist
for x in (
[d.get('relative_package_path')]
if not isinstance(d.get('relative_package_path'), list)
else d.get('relative_package_path')
)
)
def check_manifest(filename):
return filename in manifest
def check_file(dist, filename):
if not check_dist(dist, filename):
print(
missing_dist_msg.format(filename, components_package, '_js_dist'),
file=sys.stderr
)
if not check_manifest(filename):
print(missing_manifest_msg.format(filename),
file=sys.stderr)
for cur, _, files in os.walk(components_package):
for f in files:
if f.endswith('js'):
# noinspection PyProtectedMember
check_file(components_lib._js_dist, f)
elif f.endswith('css'):
# noinspection PyProtectedMember
check_file(components_lib._css_dist, f)
elif not f.endswith('py'):
check_manifest(f)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化