Sisyphus repository
Last update: 8 february 2023 | SRPMs: 18184 | Visits: 26683069
en ru br
ALT Linux repos
5.0: 3.3.1-alt2.5
4.1: 3.3.1-alt2.4.1
4.0: 3.3.1-alt2.3

Group :: System/Servers
RPM: apache2-mod_python

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

%setup_python_subpackage apache2_mod_python
%define modname mod_python
%define module_name python

%define a2_version 2.2.4-alt15

%define python_bindir %a_htdocsdir/%module_name
Name: apache2-mod_python%__python_package_version
Version: 3.3.1
Release: alt2.4.1

Summary: Python module for Apache2
Group: System/Servers
License: Free
Packager: Alexey Morsov <swi at>

Source: %modname-%version.tgz
Source1: python.load
Source2: python.conf
Source3: python.start

BuildRequires: flex python-dev python-modules-encodings
BuildRequires: apache2-devel >= %a2_version
BuildRequires: rpm-build-python >= 0.21-alt1
BuildRequires: python-base >= 2.4.4

Requires: python = %__python_version
Requires: apache2 >= %a2_version

Conflicts: mod_python
Provides: mod_python%__python_version

%add_python_req_skip _apache
%add_python_req_skip _psp

mod_python is an Apache2 module that embeds the Python interpreter within the server.
With mod_python you can write web-based applications in Python that will run many
times faster than traditional CGI and will have access to advanced features such as
ability to retain database connections and other data between hits and access to
Apache internals.

%setup -q -n %modname-%version

%configure --with-apxs=%apache_apxs --prefix=%prefix --with-python-bin=%__python

install -d -m 755 -- $RPM_BUILD_ROOT%a_mods_available
install -d -m 755 -- $RPM_BUILD_ROOT%a_mods_start
install -d -m 755 -- $RPM_BUILD_ROOT%a_libexecdir
install -d -m 755 -- $RPM_BUILD_ROOT%a_addondocdir/%modname

install -p -m 644 -- %SOURCE1 $RPM_BUILD_ROOT%a_mods_available/%module_name.load
install -p -m 644 -- %SOURCE2 $RPM_BUILD_ROOT%a_mods_available/%module_name.conf
subst 's, at a_libexecdir at ,%a_libexecdir,g' $RPM_BUILD_ROOT%a_mods_available/%module_name.load
subst 's, at python_bindir at ,%python_bindir,g' $RPM_BUILD_ROOT%a_mods_available/%module_name.conf
install -p -m 644 -- %SOURCE3 $RPM_BUILD_ROOT%a_mods_start/100-%module_name.conf

mkdir -p %buildroot{%python_sitelibdir/%modname,%_docdir/%modname-%version/icons,%python_bindir,\

%__install -c src/ %buildroot%a_libexecdir

for i in `ls lib/python/%modname/*.py`; do
 %__install -m 0644 $i %buildroot%python_sitelibdir/%modname;

# docs

for i in `ls doc-html/*.html doc-html/*.css`; do
 %__install -m 0644 $i %buildroot%_docdir/%modname-%version;
for i in `ls doc-html/icons/*.gif`; do
 %__install -m 0644 $i %buildroot%_docdir/%modname-%version/icons;

%__ln_s %_docdir/%modname-%version %buildroot%a_addondocdir/%modname

### Creating

%__cat <<EOF >
from mod_python import apache

def handler(req):
   req.write("Hello World!")
   return apache.OK

#%__install -m 0644 A.%modname.conf %buildroot%apache_addonconfdir/

%__install -m 0644 %buildroot%python_bindir/

# Reconfigure Apache2:
%a_sbindir/a2chkconfig ||:

if [ -e %a_mods_enabled/%module_name.load ]; then
   %a_sbindir/apachectl2 configtest && CONF_OK=1 ||:
   if [ "$CONF_OK" = "1" ]; then
       service %a_dname condrestart ||:
       echo "Some errors detected in Apache2 configuration!"
       echo "To use %modname check configuration and start %a_dname service."
   echo "Apache2 %modname module had been installed, but does't enabled."
   echo "Check %a_mods_start directory for files with '%module_name=no' lines."

if [ "$1" = "0" ] ; then # last uninstall
   [ -e %a_mods_enabled/%module_name.load ] && %a_sbindir/a2dismod %module_name 2>&1 >/dev/null ||:

# Reconfigure Apache2:
%a_sbindir/a2chkconfig ||:
if [ "$1" = "0" ] ; then # last uninstall
   %a_sbindir/apachectl2 configtest && CONF_OK=1 ||:
   if [ "$CONF_OK" = "1" ]; then
service %a_dname condrestart ||:
       echo "Some errors detected in Apache2 configuration!"
echo "To complete %module_name uninstalling check configuration and restart %a_dname service."

%dir %attr(0775,root,%apache_webmaster) %python_bindir
%attr(0664,root,%apache_webmaster) %python_bindir/*
%config(noreplace) %a_mods_available/%module_name.conf
%config            %a_mods_available/%module_name.load
%config            %a_mods_start/100-%module_name.conf


Full changelog you can see here

design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin