File apache2-mod_python.spec of Package apache2-mod_python.4164

#
# spec file for package apache2-mod_python
#
# Copyright (c) 2017 SUSE LINUX 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 http://bugs.opensuse.org/
#


%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}
%endif

Name:           apache2-mod_python
BuildRequires:  apache-rpm-macros
BuildRequires:  apache2-devel
BuildRequires:  pcre-devel
%if 0%{?sles_version} == 9
BuildRequires:  python25
BuildRequires:  python25-devel
PreReq:         python25
%else
BuildRequires:  python-devel
%{py_requires}
%endif
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} %{apache_suse_maintenance_mmn}
Conflicts:      mod_python
Url:            http://www.modpython.org/
Source:         %{modname}-%{version}.tar.bz2
Patch0:         mod_python-3.5.0-do-not-load-site-py.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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

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
/usr/share/doc/packages/apache2-mod_python/doc-html/index.html.

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

sed -i "
s@setup.py install@setup.py install --prefix=%{_prefix} --root=$RPM_BUILD_ROOT@
;
s@'lib'@'%{_lib}'@
" dist/setup.py.in
%__sed -i 's@GIT.*$@GIT=none@' dist/version.sh

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

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

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

%files
%defattr(-,root,root)
%doc COPYRIGHT CREDITS NEWS doc-html
%{apache_libexecdir}/%{modname}.so
%{python_sitearch}/*
%{_bindir}/mod_python

%changelog
openSUSE Build Service is sponsored by