Skip to content

Commit

Permalink
chore: fix Python build of s3-deployent on macOS (#1141)
Browse files Browse the repository at this point in the history
On macOS developers are likely to use a Homebrew Python,
which comes with a default pip installation prefix configured.

On those systems, running 'pip install --target' leads to the following
error:

DistutilsOptionError: must supply either home or prefix/exec-prefix — not both

Override the system prefix to be empty, and just force
pip to install in the given directory.
  • Loading branch information
rix0rrr authored Nov 12, 2018
1 parent cd7947c commit c5fd907
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/@aws-cdk/aws-s3-deployment/lambda/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ rm -f ${bundle_out}

# prepare staging
staging="$(mktemp -d)"
rm -fr ${staging}
mkdir -p ${staging}
piptemp="$(mktemp -d)"
trap "rm -rf ${staging} ${piptemp}" EXIT

echo "staging lambda bundle at ${staging}..."

Expand All @@ -25,7 +25,10 @@ rsync -av src/ "${staging}"
cd ${staging}

# install python requirements
pip3 install -r requirements.txt -t .
# Must use --prefix to because --target cannot be used on
# platforms that have a default --prefix set.
pip3 install --prefix ${piptemp} -r ${staging}/requirements.txt
mv ${piptemp}/lib/python*/site-packages/* .

# create archive
zip -qr ${bundle_out} .
Expand Down

0 comments on commit c5fd907

Please sign in to comment.