%{!?python_standard_lib: %define python_standard_lib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(standard_lib=1)")}

Name:           pymsn-t
Version:        0.11.2
Release:        1
Summary:        MSN Transport for Jabber Servers

Group:          Applications/Internet
License:        GPL
URL:            http://delx.cjb.net/pymsnt/
Source0:        http://delx.cjb.net/pymsnt/tarballs/pymsnt-%{version}.tar.gz
Source1:        pymsn-t.init
Patch0:         config.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch
BuildRequires:  python-devel
Requires:       python-twisted
Requires:       python-imaging
Requires:       pyOpenSSL

Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service

%description
The MSN Transport provides a gateway which allows Jabber users to
communicate with their contacts on the MSN network.

The transport must be installed on the Jabber server, and it's
operation is nearly transparent to the user. They can interact with
their MSN contacts in the same way as they do with their Jabber
contacts.

#%package mysql
#Summary: MySQL backend for AIM transport
#Group: Applications/Internet
#Requires: MySQL-python
#Requires: pyaim-t = %{version}-%{release}
#
#%description mysql
#MySQL backend for AIM transport

%prep
%setup -q -n pymsnt-%{version}
%patch0 -p0

%build
%{__python}    %{python_standard_lib}/compileall.py .
%{__python} -O %{python_standard_lib}/compileall.py .

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/etc/pymsn-t
mkdir -p %{buildroot}%{_datadir}/pymsn-t
mkdir -p %{buildroot}/var/spool/pymsn-t
mkdir -p %{buildroot}%{_initrddir}

cp %{S:1} %{buildroot}%{_initrddir}/pymsn-t
chmod a+x %{buildroot}%{_initrddir}/pymsn-t

touch %{buildroot}/etc/pymsn-t/config.xml

cp PyMSNt.py* %{buildroot}%{_datadir}/pymsn-t
chmod a+x %{buildroot}%{_datadir}/pymsn-t/PyMSNt.py
cp -r data %{buildroot}%{_datadir}/pymsn-t
cp -r src %{buildroot}%{_datadir}/pymsn-t
 
%clean
rm -rf %{buildroot}

%post
/sbin/chkconfig --add pymsn-t

%preun
if [ $1 = 0 ]; then
        /sbin/service pymsn-t stop >/dev/null 2>&1
        /sbin/chkconfig --del pymsn-t
fi

%postun
if [ "$1" -ge "1" ]; then
        /sbin/service pymsn-t condrestart >/dev/null 2>&1
fi

%files
%defattr(-,root,root,-)
%doc COPYING config-example.xml README  TODO

%{_initrddir}/pymsn-t

%dir %{_sysconfdir}/pymsn-t
%ghost %config(noreplace) %{_sysconfdir}/pymsn-t/config.xml

#%exclude %{_datadir}/pyaim-t/src/xdb/mysql.py*
%{_datadir}/pymsn-t

%dir %{_localstatedir}/spool/pymsn-t

#%files mysql
#%defattr(-,root,root,-)
#%doc tools/db-setup.mysql
#
#%{_datadir}/pyaim-t/src/xdb/mysql.py*

%changelog
* Thu Mar 22 2007 Scott R. Shinn <scott@atomicrocketturtle.com> - 0.8-1
- ported pyicq-t to pyaim-t
- updated init script 
- updated config.patch

* Fri Dec  8 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.8-3
- Fix up requires for mysql subpackage.

* Fri Dec  8 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.8-2
- Bump release and rebuild for Python 2.5
- Use macro for path to standard library
- Eliminate provides/obsoletes pyicqt

* Tue Oct 31 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.8-1
- Update to 0.8 (see http://www.blathersource.org/releases_view.php?projid=pyicq-t&relid=28)
- Fix init script to create subsys lock file

* Thu Sep  7 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.7-5
- Really no longer ghost *.pyo files

* Mon Aug 14 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.7-4
- No longer ghost *.pyo files

* Wed Aug  2 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.7-3
- Rename more stuff to pyicq-t

* Sun Jul 30 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.7-2
- Rename to pyicq-t
- Change Group tag

* Wed Jul 26 2006 Jeffrey C. Ollie <jeff@ocjtech.us> - 0.7-1
- First version for Fedora Extras