Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Merge pull request Miserlou#18 from Winter-Guerra/master
Browse files Browse the repository at this point in the history
Added compiled package `regex` to library
  • Loading branch information
Rich Jones authored Jan 12, 2017
2 parents 29a0667 + c5b79ff commit b224959
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lambda_packages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
'path': os.path.join(os.path.dirname(os.path.abspath(__file__)),
'cryptography', 'cryptography-1.4.tar.gz')
},
'regex': {
'version': '2016.8.27',
'path': os.path.join(os.path.dirname(os.path.abspath(__file__)),
'regex', 'regex-2016.8.27.tar.gz')
},
'pyproj': {
'version': '1.9.5',
'path': os.path.join(os.path.dirname(os.path.abspath(__file__)),
Expand Down
13 changes: 13 additions & 0 deletions lambda_packages/regex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
##Notes

This package is required for use of the package [flanker](https://github.com/mailgun/flanker) (an email parsing library) in the lambda execution environment.

##Build

`./build.sh regex 2016.8.27`


## AWS Lambda execution environment
Built on **ami-6869aa05**, US East (N. Virginia), us-east-1.

See [official docs](http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html) for more details about supported version.
62 changes: 62 additions & 0 deletions lambda_packages/regex/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -ex
set -o pipefail

prefix="pillow-build"
bucket="<YOUR BUCKET>"
region="<YOUR REGION>"

echo "do update"
yum update -y

echo "do dependcy install"
yum install -y \
gcc \
libtiff-devel \
libzip-devel \
libjpeg-devel \
freetype-devel \
lcms2-devel \
libwebp-devel \
tcl-devel \
tk-devel

echo "copy webp deps"
cd /usr/lib64/
find . -name "*webp*" | cpio -pdm ~/env/lib64/python2.7/site-packages/
cd ~/
chmod 755 -R env/lib64/python2.7/site-packages/

echo "make env"
/usr/bin/virtualenv \
--python /usr/bin/python env \
--always-copy



echo "activate env in `pwd`"
source env/bin/activate

echo "install pips"
pip install --verbose --use-wheel pillow
deactivate

echo "tar lib and lib64"
mkdir Pillow-3.1.1
cp -a env/lib/python2.7/site-packages/. Pillow-3.1.1/
cp -a env/lib64/python2.7/site-packages/. Pillow-3.1.1/
cd Pillow-3.1.1/ && tar -zcvf ../Pillow-3.1.1.tar.gz * && cd ..

#make lambda test
cd Pillow-3.1.1/
wget https://raw.githubusercontent.com/Miserlou/lambda-packages/master/lambda_packages/Pillow/test/test.jpg
wget https://raw.githubusercontent.com/Miserlou/lambda-packages/master/lambda_packages/Pillow/test/test.py
zip -r9 ../test.zip * && cd ..

if [ "$bucket" != "<YOUR BUCKET>" ] && [ "$region" != "<YOUR REGION>" ]
then
echo "uploading to $bucket in $region"
aws s3 cp test.zip s3://$bucket/$dir/test.zip --region $region
aws s3 cp Pillow-3.1.1.tar.gz s3://$bucket/$dir/Pillow-3.1.1.tar.gz --region $region
fi
Binary file added lambda_packages/regex/regex-2016.8.27.tar.gz
Binary file not shown.

0 comments on commit b224959

Please sign in to comment.