Browse Source

new: [0k-openerp] install pillow instead of PIL.

postgres
Valentin Lab 10 years ago
parent
commit
e752059cda
  1. 196
      precise/0k-openerp/hooks/install

196
precise/0k-openerp/hooks/install

@ -30,7 +30,6 @@ test -z "$RELEASE" && RELEASE=$(lsb_release -c -s)
## Code ## Code
## ##
if [ -z "$NO_VIRTUALENV" ]; then if [ -z "$NO_VIRTUALENV" ]; then
set +ex set +ex
source /srv/virtualenv/default/bin/activate source /srv/virtualenv/default/bin/activate
@ -39,82 +38,14 @@ fi
if [ "$NO_VIRTUALENV" ]; then if [ "$NO_VIRTUALENV" ]; then
apt-get install -y --no-install-recommends python-geoip python-gevent \ apt-get install -y --no-install-recommends python-geoip python-gevent \
python-ldap python-lxml python-markupsafe python-pil python-pip \
python-psutil python-psycopg2 python-pychart python-pydot python-pil \
python-ldap python-lxml python-markupsafe python-pip \
python-psutil python-psycopg2 python-pychart python-pydot \
python-reportlab python-simplejson python-yaml wget wkhtmltopdf \ python-reportlab python-simplejson python-yaml wget wkhtmltopdf \
python-mysqldb python-mysqldb
else
##
## Installing PIL
##
## install deps for PIL compilations
## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204
DEV="libxml2-dev libxslt-dev libpq-dev libyaml-dev
zlib1g-dev libfreetype6-dev
libsasl2-dev libjpeg-dev libmysqlclient-dev"
LIB="libxslt1.1 libpq5 libjpeg8 libtiff5 libmysqlclient18"
apt-get install $DEV $LIB \
-y --force-yes --no-install-recommends
if ! [ -e "/usr/lib/libjpeg.so" ]; then
if [ "$RELEASE" == "trusty" ]; then
## for some reason /etc/apt/sources.list can be WITHOUT deb-src lines
apt-cache policy python-imaging | tail -n 1 | \
while read code url distrib arch type; do
echo deb-src $url $(echo "$distrib" | tr "/" " ");
done >> /etc/apt/sources.list &&
apt-get update
fi
if ! [ -d "/usr/include/freetype2/freetype" ]; then
(cd /usr/include/freetype2 &&
ln -sf . freetype)
fi
apt-get build-dep python-imaging -y --force-yes &&
ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ &&
ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ &&
ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
fi
## Installing PIL with our archive is safer.
#pip install pil
(
cd /tmp &&
scp "$GIT_0K_BASE"/archives/PIL-1.1.7.tar.gz . &&
tar xvzf PIL-1.1.7.tar.gz &&
cd PIL-1.1.7 &&
python setup.py install
cd /tmp
rm -rf /tmp/PIL-1.1.7
)
## Install pychart... from our repo as :
## download link in PyPi is dead,
## and gna.org was down recently
(
scp "$GIT_0K_BASE/archives/PyChart-1.39.tar.gz" /tmp &&
cd /tmp && tar xvzf PyChart*.tar.gz &&
cd PyChart* &&
python setup.py install &&
cd /tmp &&
rm -rf /tmp/PyChart*
)
## should be in connectors requirements.
pip install mysql-python
fi fi
@ -175,10 +106,10 @@ fi
## ##
AVOID_INSTALL=
AVOID_INSTALL="pil pillow"
if [ "$NO_VIRTUALENV" ]; then if [ "$NO_VIRTUALENV" ]; then
## These are provided in the system already
AVOID_INSTALL="psycopg2 pil lxml gevent python-ldap MarkupSafe
## These are provided in the system already our by our means
AVOID_INSTALL="$AVOID_INSTALL psycopg2 lxml gevent python-ldap MarkupSafe
psutil http://download.gna.org/pychart/PyChart-1.39.tar.gz psutil http://download.gna.org/pychart/PyChart-1.39.tar.gz
pydot reportlab simplejson PyYAML" pydot reportlab simplejson PyYAML"
fi fi
@ -204,11 +135,107 @@ fi
for pack in $AVOID_INSTALL; do for pack in $AVOID_INSTALL; do
sed -ri "s%^($pack.*)$%#\1%g" /tmp/requirements.txt sed -ri "s%^($pack.*)$%#\1%g" /tmp/requirements.txt
done done
pip install -r /tmp/requirements.txt || exit 1
) || exit 1
##
## Install PIL/Pillow if in Virtualenv or if Pillow is needed
##
NEED_PILLOW=$(cat /tmp/requirements.txt | grep -i "^pillow")
if [ -z "$NO_VIRTUALENV" -o "$NEED_PILLOW" ]; then
##
## Installing PIL/Pillow
##
if [ "$NEED_PILLOW" ]; then
DEV="$DEV build-essential libtiff5-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev
tcl8.5-dev tk8.5-dev python-tk python-dev"
LIB="$LIB python-tk libjpeg8 libtiff5"
else
## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204
DEV="$DEV libxml2-dev libxslt-dev libpq-dev libyaml-dev
zlib1g-dev libfreetype6-dev
libsasl2-dev libjpeg-dev libmysqlclient-dev"
LIB="libxslt1.1 libpq5 libjpeg8 libtiff5 libmysqlclient18"
fi
## install deps for PIL compilations
apt-get install $DEV $LIB \
-y --force-yes --no-install-recommends
if ! [ -e "/usr/lib/libjpeg.so" ]; then
if [ "$RELEASE" == "trusty" ]; then
## for some reason /etc/apt/sources.list can be WITHOUT deb-src lines
apt-cache policy python-imaging | tail -n 1 | \
while read code url distrib arch type; do
echo deb-src $url $(echo "$distrib" | tr "/" " ");
done >> /etc/apt/sources.list &&
apt-get update
fi
if ! [ -d "/usr/include/freetype2/freetype" ]; then
(cd /usr/include/freetype2 &&
ln -sf . freetype)
fi
apt-get build-dep python-imaging -y --force-yes &&
ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ &&
ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ &&
ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
fi
if [ "$NEED_PILLOW" ]; then
pip install "$NEED_PILLOW"
else
## Installing PIL with our archive is safer.
#pip install pil
(
cd /tmp &&
scp "$GIT_0K_BASE"/archives/PIL-1.1.7.tar.gz . &&
tar xvzf PIL-1.1.7.tar.gz &&
cd PIL-1.1.7 &&
python setup.py install
cd /tmp
rm -rf /tmp/PIL-1.1.7
)
fi
fi
if [ -z "$NO_VIRTUALENV" ]; then
## Install pychart... from our repo as :
## download link in PyPi is dead,
## and gna.org was down recently
(
scp "$GIT_0K_BASE/archives/PyChart-1.39.tar.gz" /tmp &&
cd /tmp && tar xvzf PyChart*.tar.gz &&
cd PyChart* &&
python setup.py install &&
cd /tmp &&
rm -rf /tmp/PyChart*
)
## should be in connectors requirements.
pip install mysql-python
fi
pip install -r /tmp/requirements.txt || exit 1
rm /tmp/requirements.txt
rm /tmp/requirements.txt
) || exit 1
## System user ## System user
adduser --system --home=/var/lib/openerp --group openerp adduser --system --home=/var/lib/openerp --group openerp
@ -244,7 +271,6 @@ cp -i etc/default/openerp-server /etc/default/openerp-server
## Linking with external filestore ! ## Linking with external filestore !
## ##
( (
## keeping for compatibility with older version ## keeping for compatibility with older version
cd /opt/apps/0k-oe/odoo/openerp && cd /opt/apps/0k-oe/odoo/openerp &&
@ -261,9 +287,19 @@ ln -sf "/opt/apps/0k-oe/bin/oe" "/usr/local/bin/oe"
## Remove all unwanted libs ## Remove all unwanted libs
## ##
if [ -z "$NO_VIRTUALENV" ]; then
apt-get autoremove -y --force-yes $(apt-cache showsrc python-imaging |
if [ -z "$NO_VIRTUALENV" -o "$NEED_PILLOW" ]; then
if [ "$NEED_PILLOW" ]; then
## it won't work for pillow as we didn't use any Build-Depends
BUILD_DEPS=
else
BUILD_DEPS="python-imaging"
fi
for dep in $BUILD_DEPS; do
apt-get autoremove -y --force-yes $(apt-cache showsrc "$dep" |
sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),*\|\[[^]]*\]//g') sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),*\|\[[^]]*\]//g')
done
fi fi
apt-get autoremove $DEV -y --force-yes apt-get autoremove $DEV -y --force-yes
Loading…
Cancel
Save