未验证 提交 b5d2df95 编写于 作者: Q Qiao Longfei 提交者: GitHub

Fix build (#192)

* fix build problem that the first build has no js.
* use for loop to check if frontend file is duplicated
* package_data use *.js *.html to match file
上级 fa7b30e0
......@@ -8,12 +8,25 @@ BUILD_DIR=$TOP_DIR/build
mkdir -p $BUILD_DIR
check_duplicated() {
filename_format=$1
file_num=`ls dist/${filename_format} | wc -l | awk '{$1=$1;print}'`
if [ "$file_num" != "1" ]; then
echo "dist have duplicate file for $file_num, please clean and rerun"
exit 1
fi
}
build_frontend() {
cd $FRONTEND_DIR
if [ ! -d "dist" ]; then
npm install
npm run build
fi
for file_name in "manifest.*.js" "index.*.js" "vendor.*.js"; do
echo $file_name
check_duplicated $file_name
done
}
build_frontend_fake() {
......@@ -43,6 +56,14 @@ build_onnx_graph() {
protoc onnx.proto --python_out .
}
clean_env() {
rm -rf $TOP_DIR/visualdl/server/dist
rm -rf $BUILD_DIR/bdist*
rm -rf $BUILD_DIR/lib*
rm -rf $BUILD_DIR/temp*
rm -rf $BUILD_DIR/scripts*
}
package() {
cp -rf $FRONTEND_DIR/dist $TOP_DIR/visualdl/server/
cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl
......@@ -53,12 +74,13 @@ ARG=$1
echo "ARG: " $ARG
if [ $ARG = "travis-CI" ]; then
if [ "$ARG" = "travis-CI" ]; then
build_frontend_fake
else
build_frontend
fi
clean_env
build_backend
build_onnx_graph
package
......@@ -76,14 +76,6 @@ packages = [
'visualdl.server.onnx',
]
datas = []
data_root = os.path.join(TOP_DIR, 'visualdl/server/dist')
for root, dirs, files in os.walk(data_root):
for filename in files:
path = 'dist/' + os.path.join(root, filename)[len(data_root) + 1:]
datas.append(path)
print datas
setup(
name="visualdl",
version=VERSION_NUMBER,
......@@ -94,7 +86,8 @@ setup(
long_description=read('README.md'),
install_requires=install_requires,
package_data={
'visualdl.server': datas,
'visualdl.server':
['dist/*.js', 'dist/*.html', 'dist/fonts/*', 'dist/images/*'],
'visualdl': ['core.so'],
'visualdl.python': ['core.so', 'dog.jpg']
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册