File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ Usage: build.sh [-p PYTHON_VER] [-n NAME] [-r] [-h] [-v]
53
53
-n NAME : Name of the layer
54
54
-r : Raw mode, don't zip layer contents
55
55
-d : Don't install Python dependencies
56
+ -s : Don't strip .so files
56
57
-h : Help
57
58
-v : Display build.sh version
58
59
```
Original file line number Diff line number Diff line change @@ -56,8 +56,10 @@ rm -rf pip*
56
56
find . -type d -name " tests" -exec rm -rf {} +
57
57
find . -type d -name " test" -exec rm -rf {} +
58
58
find . -type d -name " __pycache__" -exec rm -rf {} +
59
- find -name " *.so" -not -path " */PIL/*" | xargs strip
60
- find -name " *.so.*" -not -path " */PIL/*" | xargs strip
59
+ if [[ " $STRIP " == true ]]; then
60
+ find -name " *.so" -not -path " */PIL/*" | xargs strip
61
+ find -name " *.so.*" -not -path " */PIL/*" | xargs strip
62
+ fi
61
63
find . -name ' *.pyc' -delete
62
64
if [[ -f " /temp/build/_clean.sh" ]]; then
63
65
echo " Running custom cleaning script"
Original file line number Diff line number Diff line change @@ -32,17 +32,19 @@ usage() {
32
32
echo -e " -n NAME\t: Name of the layer"
33
33
echo -e " -r\t\t: Raw mode, don't zip layer contents"
34
34
echo -e " -d\t\t: Don't install Python dependencies"
35
+ echo -e " -s\t\t: Don't strip .so files"
35
36
echo -e " -h\t\t: Help"
36
37
echo -e " -v\t\t: Display ${scriptname} version"
37
38
}
38
39
39
40
# Handle configuration
40
- while getopts " :p:n:drhv " arg; do
41
+ while getopts " :p:n:dsrhv " arg; do
41
42
case " ${arg} " in
42
43
p) PYTHON_VER=${OPTARG} ;;
43
44
n) NAME=${OPTARG} ;;
44
45
r) RAW_MODE=true;;
45
46
d) NO_DEPS=true;;
47
+ s) STRIP=false;;
46
48
h) usage; exit ;;
47
49
v) displayVer; exit ;;
48
50
\? ) echo -e " Error - Invalid option: $OPTARG " ; usage; exit ;;
@@ -59,6 +61,7 @@ BASE_DIR=$(basename $CURRENT_DIR)
59
61
PARENT_DIR=${CURRENT_DIR% " ${BASE_DIR} " }
60
62
RAW_MODE=" ${RAW_MODE:- false} "
61
63
NO_DEPS=" ${NO_DEPS:- false} "
64
+ STRIP=" ${STRIP:- true} "
62
65
63
66
# Find location of requirements.txt
64
67
if [[ -f " ${CURRENT_DIR} /requirements.txt" ]]; then
93
96
94
97
if [[ " $RAW_MODE " = true ]]; then
95
98
echo " Using RAW mode"
96
- else
99
+ else
97
100
echo " Using ZIP mode"
98
101
fi
99
102
100
103
# Run build
101
- docker run --rm -e PYTHON_VER=" $PYTHON_VER " -e NAME=" $NAME " -e RAW_MODE=" $RAW_MODE " -e NO_DEPS=" $NO_DEPS " -e PARENT_DIR=" ${PARENT_DIR} " -e SUBDIR_MODE=" $SUBDIR_MODE " -v " $CURRENT_DIR " :/var/task -v " $REQ_PATH " :/temp/build/requirements.txt -v " $CLEAN_PATH " :/temp/build/_clean.sh " lambci/lambda:build-python${PYTHON_VER} " bash /var/task/_make.sh
104
+ docker run --rm -e PYTHON_VER=" $PYTHON_VER " -e NAME=" $NAME " -e RAW_MODE=" $RAW_MODE " -e NO_DEPS=" $NO_DEPS " -e STRIP= " $STRIP " -e PARENT_DIR=" ${PARENT_DIR} " -e SUBDIR_MODE=" $SUBDIR_MODE " -v " $CURRENT_DIR " :/var/task -v " $REQ_PATH " :/temp/build/requirements.txt -v " $CLEAN_PATH " :/temp/build/_clean.sh " lambci/lambda:build-python${PYTHON_VER} " bash /var/task/_make.sh
102
105
103
106
# Move ZIP to parent dir if SUBDIR_MODE set
104
107
if [[ " $SUBDIR_MODE " ]]; then
You can’t perform that action at this time.
0 commit comments