Permalink
Browse files

Test and serve cc.engine content in Python3.

  • Loading branch information...
robmyers committed Dec 16, 2017
1 parent 462fe31 commit 39900f2ee0ba6854412c4a43ca97ceb212942d97
Showing with 64 additions and 76 deletions.
  1. +4 −0 .gitignore
  2. +20 −0 README.md
  3. +2 −2 python_env/config.ini
  4. +7 −49 scripts/bootstrap_python.sh
  5. +0 −25 scripts/bootstrap_wordpress.sh
  6. +31 −0 scripts/bootstrap_wordpress_theme.sh
@@ -1,4 +1,5 @@
cc-wp-theme
new-www-theme
vendor
composer.phar
python_env/bin
@@ -10,6 +11,9 @@ python_env/local
python_env/paste_errors.log
python_env/.Python
python_env/src/
python_env/cc.engine
python_env/share
docroot/cc.licenserdf
docroot/license.rdf
docroot/license_rdf
docroot/rdf
@@ -0,0 +1,20 @@
# Installing cc.engine
scripts/bootstrap_python.sh
# Testing cc.engine
## Command Line
cd python_env
source bin/activate
REQUEST_URI=/licenses/by-sa/4.0/ REQUEST_METHOD=GET \
SERVER_NAME=creativecommons.org SERVER_PORT=80 SERVER_PROTOCOL=http \
python3 bin/ccengine.fcgi
## Local Server
cd python_env
source bin/activate
pip3 install gevent
python3 bin/ccengine-local.py
@@ -2,7 +2,7 @@
use = egg:cc.engine#ccengine_app
#filter-with = errors cache
direct_remote_paths =
images /images/
images /images/
includes /includes/
cc3 /wp-content/themes/cc3
cc4 /wp-content/themes/cc4
@@ -27,6 +27,6 @@ cache_paths = /licenses/
directory_index = index.html
[server:main]
use = egg:Flup#fcgi
use = egg:Paste#http
# host = %(host_ip)s
# port = %(port_number)s
@@ -4,64 +4,22 @@ TOPDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
pushd ${TOPDIR}
#
# Set up transifex
#
#
# Set up Python env
#
pushd python_env
virtualenv .
virtualenv -p python3 .
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
#
git clone "https://github.com/creativecommons/cc.engine"
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
pushd cc.engine
#REMOVE ME WHEN READY!!!!
git checkout python3
python setup.py develop
popd
#
# compile_mo & transstats are needed by cc.engine at runtime, run them now
@@ -21,34 +21,9 @@ wget -O - https://getcomposer.org/installer | php
php ${TOPDIR}/composer.phar install
# Make sure wp-content hierarchy is correct
mkdir -p ${TOPDIR}/docroot/wp-content/themes
mkdir -p ${TOPDIR}/docroot/wp-content/uploads
chgrp -R www-data ${TOPDIR}/docroot/wp-content/uploads
#
# Theme
#
if [ ! -d "${TOPDIR}/cc-wp-theme" ]
then
git clone https://github.com/creativecommons/cc-wp-theme.git \
"${TOPDIR}/cc-wp-theme"
else
pushd "${TOPDIR}/cc-wp-theme"
git pull
popd
fi
if [ ! -d "${TOPDIR}/docroot/wp-content/themes/creativecommons.org" ]
then
ln -s "${TOPDIR}/cc-wp-theme/creativecommons.org" \
"docroot/wp-content/themes/creativecommons.org"
ln -s "${TOPDIR}/cc-wp-theme/creativecommons.org" \
"docroot/wp-content/themes/twentyfourteen"
fi
#
# wp-config-local.php
#
@@ -0,0 +1,31 @@
#!/bin/bash
TOPDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
pushd ${TOPDIR}
#
# WordPress theme
#
# Make sure wp-content hierarchy is correct
mkdir -p ${TOPDIR}/docroot/wp-content/themes
if [ ! -d "${TOPDIR}/new-www-theme" ]
then
git clone https://github.com/creativecommons/new-www-theme.git \
"${TOPDIR}/new-www-theme"
else
pushd "${TOPDIR}/new-www-theme"
git pull
popd
fi
if [ ! -d "${TOPDIR}/docroot/wp-content/themes/cc" ]
then
ln -s "${TOPDIR}/new-www-theme/cc" \
"docroot/wp-content/themes/cc"
fi
popd # to original

0 comments on commit 39900f2

Please sign in to comment.