File apache2-mod_python.spec of Package apache2-mod_python

# spec file for package apache2-mod_python
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%if 0%{?sles_version} == 9
%define __python /usr/bin/python2.5
%define py_ver    %(%__python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
%define py_prefix %(%__python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
%define py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
%define py_incdir %{py_prefix}/include/python%{py_ver}

Name:           apache2-mod_python
BuildRequires:  apache2-devel
BuildRequires:  pcre-devel
%if 0%{?sles_version} == 9
BuildRequires:  python25
BuildRequires:  python25-devel
PreReq:         python25
BuildRequires:  python-devel
BuildRequires:  autoconf
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gcc
BuildRequires:  glibc-devel
BuildRequires:  make
%define modname mod_python
%define apxs /usr/sbin/apxs2
%define apache apache2
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache_includedir %(%{apxs} -q INCLUDEDIR)
%define apache_serverroot %(%{apxs} -q PREFIX)
%define apache_localstatedir %(%{apxs} -q LOCALSTATEDIR)
%define apache_mmn        %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
Version:        3.5.0
Release:        0
Summary:        A Python Module for the Apache 2 Web Server
License:        Apache-2.0
Group:          Productivity/Networking/Web/Servers
Requires:       apache2 %{apache_mmn}
Conflicts:      mod_python
Source:         %{modname}-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

mod_python allows embedding Python within the Apache HTTP server for a
considerable boost in performance and added flexibility in designing
Web-based applications.

Apache processes requests in stages (for example: read the request,
parse headers, check access, and so on). These stages can be
implemented by functions called handlers. Traditionally, handlers are
written in C and compiled into Apache modules. mod_python provides a
way to extend Apache functionality by writing Apache handlers in
Python. For a detailed description of the Apache request processing
process, see the Apache API notes.

For most programmers, the request and the authentication handlers
provide everything required. To ease migration from CGI and Httpdapy,
two handlers are provided that simulate these environments, allowing a
user to run scripts under mod_python with (for the most part) no
changes to the code.

mod_python originated from a project called Httpdapy. For a long time,
Httpdapy was not called mod_python because Httpdapy was not meant to be
Apache-specific. Httpdapy was designed to be cross-platform and was
initially written for the Netscape server.

Usage Hints:

To load mod_python into Apache, add it to APACHE_MODULES in
/etc/sysconfig/apache2. The configuration is described in

%setup -n %{modname}-%{version}
case %_lib in 
	lib) ;;
	*) mv lib %_lib;;
%__sed -i 's@lib/python@%{_lib}/python@'
%__sed -i " install --prefix=%{_prefix} --root=$RPM_BUILD_ROOT@
" dist/

sed -i " install --prefix=%{_prefix} --root=$RPM_BUILD_ROOT@
" dist/
%__sed -i 's@GIT.*$@GIT=none@' dist/

# RPM_OPT_FLAGS come from apxs2
%configure \
	--with-apxs=`which %{apxs}` \
	--libdir="%{_libdir}" \

make OPT="$(%{apxs} -q CFLAGS)" %{?_smp_mflags}

%__install -d $RPM_BUILD_ROOT/%{_bindir}
%__make DESTDIR=$RPM_BUILD_ROOT install


openSUSE Build Service is sponsored by