@@ -27,9 +27,10 @@ displayVer() {
27
27
# Display usage
28
28
usage () {
29
29
echo -e " AWS Lambda Layer Builder for Python Libraries\n"
30
- echo -e " Usage: ${scriptname} [-p PYTHON_VER] [-n NAME] [-r] [-h] [-v]"
30
+ echo -e " Usage: ${scriptname} [-p PYTHON_VER] [-n NAME] [-f] [- r] [-h] [-v]"
31
31
echo -e " -p PYTHON_VER\t: Python version to use: 2.7, 3.6, 3.7, 3.8 (default 3.7)"
32
32
echo -e " -n NAME\t: Name of the layer"
33
+ echo -e " -f REQ_PATH\t: Path to requirements file"
33
34
echo -e " -r\t\t: Raw mode, don't zip layer contents"
34
35
echo -e " -d\t\t: Don't install Python dependencies"
35
36
echo -e " -s\t\t: Don't strip .so files"
@@ -38,10 +39,11 @@ usage() {
38
39
}
39
40
40
41
# Handle configuration
41
- while getopts " :p:n:dsrhv" arg; do
42
+ while getopts " :p:n:f: dsrhv" arg; do
42
43
case " ${arg} " in
43
44
p) PYTHON_VER=${OPTARG} ;;
44
45
n) NAME=${OPTARG} ;;
46
+ f) REQ_PATH=${OPTARG} ;;
45
47
r) RAW_MODE=true;;
46
48
d) NO_DEPS=true;;
47
49
s) STRIP=false;;
@@ -64,7 +66,12 @@ NO_DEPS="${NO_DEPS:-false}"
64
66
STRIP=" ${STRIP:- true} "
65
67
66
68
# Find location of requirements.txt
67
- if [[ -f " ${CURRENT_DIR} /requirements.txt" ]]; then
69
+ if [[ -f $REQ_PATH ]]; then
70
+ if [[ ${REQ_PATH: 0: 1} != ' /' ]]; then
71
+ REQ_PATH=" $( pwd) /${REQ_PATH} "
72
+ fi
73
+ echo " Using requirements.txt from command line input"
74
+ elif [[ -f " ${CURRENT_DIR} /requirements.txt" ]]; then
68
75
REQ_PATH=" ${CURRENT_DIR} /requirements.txt"
69
76
echo " Using requirements.txt from script dir"
70
77
elif [[ -f " ${PARENT_DIR} /requirements.txt" ]]; then
0 commit comments