[mod_python] 2.2 is out

Mads Kiilerich Mads at Kiilerich.com
Tue Jun 13 10:10:20 EST 2000


Jun 4 I got mail from Gregory Trubetskoy:

> Also thanks to Gerhard Haering for the Suse RPM's. It'd be nice if someone
> came up and agreed to maintain with RedHat RPM, Debian package, a FreeBSD
> port and a Solaris package...

I've made a spec for RedHat, you'll find it attached. IMHO, if
you make a rpm and install it on a plain 6.2 system you'll get
something that works and can be used as a base for further
experiments.

Feedback is welcome!

Regards,

-- 
Mads Kiilerich          Sys.Adm. Cand.Polyt
Mads at Kiilerich.com      Tel. +45 38 16 26 00  Mob. +45 26 20 07 73
Møntmestervej 12B 1th,  DK-2400 NV,  Denmark

"Learned about WAP. It sucks. The more I play with WML the more sure I 
am that WAP will die out rapidly once phones doing HTML exist."    Cox

-------------- next part --------------
Summary: The Python language for use with Apache.
Name: mod_python
Version: 2.2
Release: 0
Group: System Environment/Daemons
Source0: %{name}-%{version}.tgz
Copyright: BSD-ish???
BuildRoot: %{_tmppath}/%{name}-root
Requires: apache >= 1.3 , python >= 1.5.2
BuildPrereq: apache-devel 
Packager: Mads Kiilerich <mads at kiilerich.com>

%description
Mod_python allows embedding Python within the Apache http server for a
considerable boost in performance and added flexibility in designing web based
applications. 

The RPM installs a small example in /home/httpd/mod_python which can be
accessed as http://localhost/mod_python/some/path/which/doesn/t/matter

%prep
%setup -q -n mod_python-%{version}

%build
# 1. Installing Python Libraries
/usr/bin/python /usr/lib/python1.5/compileall.py lib/python/mod_python

# 2. Compiling -- Compiling mod_python as a DSO
apxs -I /usr/include/python1.5 -c src/mod_python.c \
	/usr/lib/python1.5/config/libpython1.5.a -lpthread

%install
rm -rf $RPM_BUILD_ROOT
install -D -s src/mod_python.so $RPM_BUILD_ROOT/usr/lib/apache/mod_python.so
mkdir -p $RPM_BUILD_ROOT/usr/lib/python1.5/site-packages/mod_python
install lib/python/mod_python/* \
	$RPM_BUILD_ROOT/usr/lib/python1.5/site-packages/mod_python
mkdir -p $RPM_BUILD_ROOT/home/httpd/mod_python
cat <<CAT>$RPM_BUILD_ROOT/home/httpd/mod_python/.htaccess
SetHandler python-program
PythonHandler pythonhandler
CAT
cat <<CAT>$RPM_BUILD_ROOT/home/httpd/mod_python/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 <<CAT
*** httpd.conf.org      
--- httpd.conf  
***************
*** 206,207 ****
--- 206,208 ----
  # LoadModule foo_module modules/mod_foo.so
+ LoadModule python_module      modules/mod_python.so
  #LoadModule mmap_static_module modules/mod_mmap_static.so
***************
*** 253,254 ****
--- 254,256 ----
  ClearModuleList
+ AddModule mod_python.c
  #AddModule mod_mmap_static.c
***************
*** 965,966 ****
--- 967,974 ----
  
+ <IfModule mod_python.c>
+   Alias /mod_python/ /home/httpd/mod_python/
+   <Directory /home/httpd/mod_python>
+     AllowOverride FileInfo
+   </Directory>
+ </IfModule>
  ### Section 3: Virtual Hosts
CAT

%postun
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

%files
%defattr(-,root,root)
%attr(0755,root,root) /usr/lib/apache/mod_python.so
/usr/lib/python1.5/site-packages/mod_python
/home/httpd/mod_python
%doc COPYRIGHT doc/*.html

%changelog
* Mon Jun 13 2000 Mads Kiilerich <mads at kiilerich.com>
- Made initial version of mod_python rpm


More information about the Mod_python mailing list