-
Notifications
You must be signed in to change notification settings - Fork 208
/
Copy pathbootstrap_python.sh
executable file
·96 lines (72 loc) · 1.72 KB
/
bootstrap_python.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
TOPDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
pushd ${TOPDIR}
#
# Set up transifex
#
#
# Set up Python env
#
pushd python_env
virtualenv .
source bin/activate
# No RDF in pip (it's rdfutils)
for i in 'setuptools>=0.7' 'zope.interface>=3.8.0' Paste PasteDeploy \
PasteScript rdfutils cssselect transifex-client \
pysocks
do
pip install $i
done
# On Ubuntu, virtualenv setups don't "see" dist-packages, which is
# where Ubuntu-packaged modules go. This works around that problem:
echo "/usr/lib/python2.7/dist-packages/" \
> lib/python2.7/site-packages/dist-packages.pth
#
# Check out and set up each Python module
#
pushd src
REPOS=(cc.i18n cc.licenserdf cc.license cc.engine)
for i in "${REPOS[@]}"
do
if [ -d "${i}" ]
then
pushd "${i}"
git pull
popd
else
git clone "https://github.com/creativecommons/${i}.git"
fi
done
REPOS+=(cc.engine)
for i in "${REPOS[@]}"
do
pushd "${i}"
python bootstrap.py -v 2.1.1
bin/buildout
python setup.py develop
popd
done
popd # to python_env
#
# compile_mo & transstats are needed by cc.engine at runtime, run them now
#
bin/compile_mo
bin/transstats
popd # to topdir
#
# Generate ccengine.fcgi
#
sed -e "s|@env_dir@|${TOPDIR}/python_env|" \
< "python_env/bin/ccengine.fcgi.in" \
> "python_env/bin/ccengine.fcgi"
chmod 755 python_env/bin/ccengine.fcgi
#
# Support the semantic web
#
ln -s ${TOPDIR}/python_env/src/cc.licenserdf \
${TOPDIR}/docroot/cc.licenserdf
ln -s ${TOPDIR}/docroot/cc.licenserdf/cc/licenserdf/rdf \
${TOPDIR}/docroot/rdf
ln -s ${TOPDIR}/docroot/cc.licenserdf/cc/licenserdf/licenses \
${TOPDIR}/docroot/license_rdf
popd # to original