Summary: An Apache module to allow for Python plugins and control.
Name: mod_snake
Version: 0.5.0
Release: 1
Group: System Environment/Daemons
Copyright: BSDish
Source: mod_snake-0.5.0.tar.gz
Url: http://modsnake.sourceforge.net
BuildRoot: %{_tmppath}/%{name}-root
BuildPrereq: apache-devel
BuildPrereq: python
Requires: apache >= 1.3.12
Requires: apache-devel >= 1.3.12
Requires: python >= 1.5.2
%description
mod_snake is an Apache module which allows for execution of Python
code directly within the Apache server process. By including an
interpreter in the Apache process, Python CGIs are accelerated,
Python can be embedded within HTML and Python written modules can
control the internals of the webserver.
%prep
%setup -q -n %{name}-%{version}
%build
%configure --with-apxs=%{_sbindir}/apxs
make
%clean
rm -rf $RPM_BUILD_ROOT
%install
mkdir -p $RPM_BUILD_ROOT%{_libdir}/apache
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/snake_lib
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/examples
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/examples/tut
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/examples/filters
install -m 755 src/libmod_snake.so $RPM_BUILD_ROOT%{_libdir}/apache
install -m 644 snake_lib/*.py $RPM_BUILD_ROOT%{_datadir}/%{name}/snake_lib
install -m 644 examples/*.*py* $RPM_BUILD_ROOT%{_datadir}/%{name}/examples
install -m 644 examples/filters/*.py $RPM_BUILD_ROOT%{_datadir}/%{name}/examples/filters
install -m 644 examples/tut/*.*py* $RPM_BUILD_ROOT%{_datadir}/%{name}/examples/tut
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL MAD_PROPS NEWS README
%doc doc/*.sgml doc/*.ps doc/mod_snake doc/mod_snake_api doc/snake_lib
%{_libdir}/apache/libmod_snake.so
%{_datadir}/%{name}/*
%post
# Check to see if it is already in the configuration file
HTTPCONFFILE=%{_sysconfdir}/httpd/conf/httpd.conf
if egrep '^AddModule mod_snake.c$' $HTTPCONFFILE >/dev/null ; then
echo "Not modifying $HTTPCONFFILE. mod_snake is already loaded there."
else
# A small hack to let APXS do its thing and copy it to the same
# location
cp %{_libdir}/apache/libmod_snake.so %{_tmppath}
%{_sbindir}/apxs -i -a -n snake %{_tmppath}/libmod_snake.so
rm %{_tmppath}/libmod_snake.so
# Add example configuration information
echo "Adding example configuration information to $HTTPCONFFILE"
cat >> $HTTPCONFFILE << FOO
# Point at the mod_snake snake_lib directory
#SnakeModuleDir %{_datadir}/%{name}/snake_lib
#SnakeModuleDir %{_datadir}/%{name}/examples/tut
#SnakeModule 01_hello_world.Hello_World
#SnakeModule mod_snake_epy.SnakeEPy
#SnakeEPy on
#AddType application/x-httpd-epy .epy
FOO
fi
%postun
HTTPCONFFILE=%{_sysconfdir}/httpd/conf/httpd.conf
# Remove the Load and Addmodule for mod_snake from the conf file
cat $HTTPCONFFILE | egrep -v '^LoadModule snake_module' \
| egrep -v '^AddModule mod_snake.c' > %{_tmppath}/rpmfu.$$
cp %{_tmppath}/rpmfu.$$ $HTTPCONFFILE
echo "Some mod_snake configuration directives may need to be manually deleted"
echo "from %{_sysconfdir}/httpd/conf/httpd.conf"
%changelog
* Thu Feb 01 2001 Jon Travis
- Initial version of the RPM.