Summary: Apache/Python Integration. Name: mod_python Version: 2.7.1 Release: 1 Group: System Environment/Daemons Source0: %{name}-%{version}.tgz Copyright: Apache-like BuildRoot: %{_tmppath}/%{name}-root Requires: apache >= 1.3 , python >= 1.5.2 BuildPrereq: apache-devel Packager: Michael A. Peters %description Mod_python allows embedding Python within the Apache http server for a considerable boost in performance and added flexibility in designing web b ased applications. The RPM installs a small example in /var/www/mod_python_test which can be accessed as http://localhost/mod_python/some/path/which/doesn/t/matter %prep %setup ./configure --with-apxs=/usr/sbin/apxs --prefix=/usr %build make %install PyVER="`python -c 'import sys; print sys.version[:3]'`" rm -rf $RPM_BUILD_ROOT install -D -s -m 0755 src/mod_python.so $RPM_BUILD_ROOT/usr/lib/apache/mod_python.so mkdir -p $RPM_BUILD_ROOT/usr/lib/python${PyVER}/site-packages/mod_python install lib/python/mod_python/* \ $RPM_BUILD_ROOT/usr/lib/python${PyVER}/site-packages/mod_python mkdir -p $RPM_BUILD_ROOT/var/www/mod_python_test python /usr/lib/python${PyVER}/compileall.py /usr/lib/python${PyVER}/site-packages/mod_python cat <$RPM_BUILD_ROOT/var/www/mod_python_test/.htaccess SetHandler python-program PythonHandler pythonhandler CAT cat <$RPM_BUILD_ROOT/var/www/mod_python_test/pythonhandler.py from mod_python import apache def handler(req): req.send_http_header() req.write("Hello to the World from "+req.uri+"!") return apache.OK CAT %clean rm -rf $RPM_BUILD_ROOT %post grep -q 'LoadModule python_module' /etc/httpd/conf/httpd.conf || \ patch /etc/httpd/conf/httpd.conf < + Alias /mod_python/ /var/www/mod_python_test/ + + AllowOverride FileInfo + + ### Section 3: Virtual Hosts CAT sed -e "s/^#LoadModule python_module/LoadModule python_module/" \ -e "s/^#AddModule mod_python.c/AddModule mod_python.c/" < /etc/httpd/conf/httpd.conf > /etc/httpd/conf/httpd.conf- \ && cat /etc/httpd/conf/httpd.conf- > /etc/httpd/conf/httpd.conf # using cat instead of mv -f above guarantees permission preservation rm -f /etc/httpd/conf/httpd.conf- if [ -f /var/run/httpd.pid ]; then /etc/rc.d/init.d/httpd restart fi %preun if [ $1 = 0 ]; then perl -pi -e 's|^LoadModule python_module|#LoadModule python_module|g' \ /etc/httpd/conf/httpd.conf perl -pi -e 's|^AddModule mod_python.c|#AddModule mod_python.c|g' \ /etc/httpd/conf/httpd.conf if [ -f /var/run/httpd.pid ]; then /etc/rc.d/init.d/httpd restart fi fi %files %defattr(-,root,root) %doc doc-html/*.html %doc COPYRIGHT CREDITS NEWS README /usr/lib /var/www/mod_python_test %changelog * Fri Nov 10 2000 Michael A. Peters - Updated for RH7 (/var/www opposed to /home/httpd) - restart apache if its running upon install/deinstall, - changed %postun script to %preun and only execute it - if package is being uninstalled, not upgraded. Also - added sed script so that proper lines would be uncommented - if they existed before rpm installs. * Tue Oct 31 2000 Grisha Trubetskoy - Combined efforts of Mads Kiilerich and Sean Reifschneider * Tue Sep 24 2000 Sean Reifschneider - Initial RPM version. * Mon Jun 13 2000 Mads Kiilerich - Made initial version of mod_python rpm