%global checkout_date 20120515 %global checkout_hash 29a06fa %global required_modules pyparsing python-twisted-core python-twisted-names python-twisted-mail python-zope-interface Name: python-ldaptor Version: 0.0.44 Release: 1.%{checkout_date}git%{checkout_hash}%{?dist} Summary: Python LDAP client library License: LGPLv2 URL: https://github.com/antong/ldaptor # Upstream does not provide release tarballs, the source code can be obtained # from upstream GitHub repository: # https://github.com/antong/ldaptor/tarball/%%{checkout_hash}.tar.gz Source0: antong-ldaptor-%{checkout_hash}.tar.gz Source1: global.cfg Patch0: %{name}-remove-webui.patch Patch1: %{name}-doc-paths.patch BuildArch: noarch BuildRequires: python2-devel Requires: %{required_modules} %description Ldaptor is LDAP library written in pure Python. The library implements LDAP client logic, separately-accessible LDAP and BER protocol message generation and parsing, ASCII format LDAP filter generation and parsing, LDIF format data generation, and Samba password changing logic. %package doc Summary: Documentation for python-ldaptor package BuildRequires: dia libxslt docbook-style-xsl docbook-slides source-highlight epydoc python-docutils BuildRequires: %{required_modules} %description doc The package contains documentation for python-ldaptor package. %package tools Summary: Ldaptor command line utilities Requires: %{name} = %{version}-%{release} %description tools The package contains command line utilities build upon python-ldaptor library. %prep %setup -q -n antong-ldaptor-%{checkout_hash} # remove deprecated web interface rm -rf ldaptor/apps rm -rf ldaptor/weave.* rm -rf ldaptor/test/web/ rm -f ldaptor/test/test_webui.* %patch0 -p1 # fix paths documentation %patch1 -p1 %build make -C doc epydoc -o doc/api --name Ldaptor ldaptor --exclude 'ldaptor\.test\.' --simple-term %install %{__python} setup.py install --root %{buildroot} # library system-wide configuration mkdir -p %{buildroot}%{_sysconfdir} install -d -m 0755 %{buildroot}%{_sysconfdir}/ldaptor install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/ldaptor/ # shared data mkdir -p %{buildroot}%{_datadir} install -d -m 0755 %{buildroot}%{_datadir}/%{name} install -m 0644 ldaptor.schema %{buildroot}%{_datadir}/%{name}/ # fix permissions on executable files in the library chmod a+x %{buildroot}%{python_sitelib}/ldaptor/ldapfilter.py # install documentation mkdir -p %{buildroot}%{_docdir} install -d -m 0755 %{buildroot}%{_docdir}/%{name}-%{version} for docdir in addressbook-slides api examples ldap-intro; do cp -r doc/$docdir %{buildroot}%{_docdir}/%{name}-%{version}/ done # make *.py files in documentation not executable, rename to avoid byte-compilation mv %{buildroot}%{_docdir}/%{name}-%{version}/examples/ldif2ldif{,.py} for pyfile in $(find %{buildroot}%{_docdir}/%{name}-%{version}/examples -name "*.py"); do chmod a-x $pyfile mv $pyfile $pyfile.example done %files %doc COPYING TODO README.md %exclude %{_docdir}/%{name}-%{version}/*/ %dir %{_sysconfdir}/ldaptor %config(noreplace) %{_sysconfdir}/ldaptor/global.cfg %{_datadir}/%{name}/ %{python_sitelib}/ldaptor-0.0.0-py2.7.egg-info %{python_sitelib}/ldaptor %files doc %doc %{_docdir}/%{name}-%{version}/addressbook-slides/ %doc %{_docdir}/%{name}-%{version}/api/ %doc %{_docdir}/%{name}-%{version}/examples/ %doc %{_docdir}/%{name}-%{version}/ldap-intro/ %files tools %{_bindir}/ldaptor-* %changelog * Mon Aug 06 2012 Jan Vcelak 0.0.44-1.20120515git29a06fa - initial package