File python-mpservlets.spec of Package python-mpservlets

#
# spec file for package python-mpservlets (Version 1.1.6)
#
# Copyright (c) 2010 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 http://bugs.opensuse.org/
#



Name:           python-mpservlets
Summary:        Mod_python Servlets - a mod_python handler
License:        Apache License, Version 2.0
Group:          Development/Libraries/Python
Version:        1.1.6
Release:        22
Url:            http://www.astro.umass.edu/~dpopowich/python/mpservlets/
BuildRequires:  python-devel
BuildRequires:  apache2-devel
BuildRequires:  fdupes
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
Source:         mpservlets-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define         apache_serverroot %(/usr/sbin/apxs2 -q DATADIR)
%define         apache_sysconfdir %(/usr/sbin/apxs2 -q SYSCONFDIR)
%py_requires

%description
A mod_python handler that uses instances of subclasses of class Servlet (thus
its name) to respond to HTTP GET and POST requests.  For each request a series
of methods are called on the instance, the output of such being sent to the
client as the response.  This handler was inspired by WebWare. 

Author: 
-------
    Daniel J. Popowich


%package doc
License:        Apache License, Version 2.0
Summary:        API Reference in HTML and PDF
Group:          Documentation/Other
Requires:       %name = %version

%description doc
This package contains the API Reference in HTML and PDF for %name.

This documentation is generated using epydoc (http://epydoc.sourceforge.net)
which uses simple, special markup in python doc strings, so the source code is
well documented as well.

Author:
-------
    Daniel J. Popowich


%package tutorial
License:        Apache License, Version 2.0
Summary:        A tutorial on developing web applications using servlets
Group:          Documentation/Other
Requires:       %name = %version

%description tutorial
This package contains a tutorial on developing web applications using %name.

Author:
-------
    Daniel J. Popowich


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

%build

%install
python setup.py install --root=%{buildroot} \
                        --record-rpm=INSTALLED_FILES --prefix=%{_prefix}
#
# install documentation
mkdir -p %{buildroot}/%_defaultdocdir/%{name}
install -m644 README LICENSE %{buildroot}/%_defaultdocdir/%{name}/
cp -r Doc %{buildroot}/%_defaultdocdir/%{name}/
#
# install the tutorial
mkdir -p %{buildroot}/%{apache_serverroot}/%{name}-tutorial
cp -r tutorial/* %{buildroot}/%{apache_serverroot}/%{name}-tutorial/ 
#
# install an apache config
mkdir -p %{buildroot}/%{apache_sysconfdir}/conf.d/
cat > %{buildroot}/%{apache_sysconfdir}/conf.d/%{name}-tutorial.conf << EOF
Alias /mps_tutorial %{apache_serverroot}/%{name}-tutorial
<Directory %{apache_serverroot}/%{name}-tutorial>
  <IfModule mod_python.c>
    SetHandler mod_python
    PythonHandler mod_python.servlet
    PythonDebug on
  </IfModule>
  order allow,deny
  allow from all
</Directory>
EOF

%fdupes %{buildroot}/%_defaultdocdir

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%dir %_defaultdocdir/%{name}
%doc %_defaultdocdir/%{name}/README
%doc %_defaultdocdir/%{name}/LICENSE
%{python_sitelib}/*

%files doc
%defattr(-,root,root)
%_defaultdocdir/%{name}/Doc

%files tutorial
%defattr(-,root,root)
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}-tutorial.conf
%{apache_serverroot}/%{name}-tutorial

%changelog
openSUSE Build Service is sponsored by