Skip to content

Commit e2b99e1

Browse files
committed
add exclude files in python packaging
1 parent e9fd34c commit e2b99e1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

python/bin/package-python.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@
33
# directory used for deployment
44
export DEPLOY_DIR=lambda
55

6-
echo Creating deploy package
6+
# Get Python version
7+
PYVERSION=$(cat /root/.pyenv/version)
8+
MAJOR=${PYVERSION%%.*}
9+
MINOR=${PYVERSION#*.}
10+
PYVER=${PYVERSION%%.*}${MINOR%%.*}
11+
PYPATH=/root/.pyenv/versions/$PYVERSION/lib/python3.6/site-packages/
712

8-
EXCLUDE="boto3* botocore* pip* docutils* *.pyc setuptools* wheel* coverage* testfixtures* mock* *.egg-info *.dist-info"
13+
echo Creating deploy package for Python $PYVERSION
14+
15+
EXCLUDE="boto3* botocore* pip* docutils* *.pyc setuptools* wheel* coverage* testfixtures* mock* *.egg-info *.dist-info __pycache__ easy_install.py"
916

1017
EXCLUDES=()
1118
for E in ${EXCLUDE}
1219
do
13-
echo ${E}
1420
EXCLUDES+=("--exclude ${E} ")
1521
done
1622

17-
rsync -ax $PREFIX/lib/python$PYVER/site-packages/ $DEPLOY_DIR/ ${EXCLUDES[@]}
18-
rsync -ax $PREFIX/lib64/python$PYVER/site-packages/ $DEPLOY_DIR/ ${EXCLUDES[@]}
23+
rsync -ax $PYPATH/ $DEPLOY_DIR/ ${EXCLUDES[@]}
1924

2025
# zip up deploy package
2126
cd $DEPLOY_DIR

0 commit comments

Comments
 (0)