[python-ldaptor] package import

jvcelak jvcelak at fedoraproject.org
Fri Aug 10 11:11:12 UTC 2012


commit f7281ea00d9bd0517c6c0c07b5c0ed61e4bfdf83
Author: Jan Vcelak <jvcelak at redhat.com>
Date:   Fri Aug 10 13:10:44 2012 +0200

    package import
    
    Resolves: #846223

 .gitignore                        |    1 +
 global.cfg                        |    6 +
 python-ldaptor-doc-paths.patch    |   52 ++++++++++
 python-ldaptor-remove-webui.patch |  190 +++++++++++++++++++++++++++++++++++++
 python-ldaptor.spec               |  118 +++++++++++++++++++++++
 sources                           |    1 +
 6 files changed, 368 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..fcf497c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/antong-ldaptor-29a06fa.tar.gz
diff --git a/global.cfg b/global.cfg
new file mode 100644
index 0000000..90dee1c
--- /dev/null
+++ b/global.cfg
@@ -0,0 +1,6 @@
+#
+# This is the global configuration file for the python-ldaptor library
+# User specific options can be placed in ~/.ldaptor/global.cfg
+#
+# example: /usr/share/doc/python-ldaptor-*/examples/global.cfg
+#
diff --git a/python-ldaptor-doc-paths.patch b/python-ldaptor-doc-paths.patch
new file mode 100644
index 0000000..38c8e98
--- /dev/null
+++ b/python-ldaptor-doc-paths.patch
@@ -0,0 +1,52 @@
+Update paths in documentation source files for compilation on newest Fedora.
+
+Author: Jan Vcelak <jvcelak at redhat.com>
+
+diff --git a/doc/Makefile b/doc/Makefile
+index aba2c84..3896f44 100644
+--- a/doc/Makefile
++++ b/doc/Makefile
+@@ -38,7 +38,7 @@ rsync: $(GENERATED)
+ $(DOCBOOK:%.xml=%/index.html): %/index.html: %.xml
+ 	install -d -m0755 '$(@D)'
+ 	xsltproc  --nonet \
+-		/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/xhtml/docbook.xsl \
++		/usr/share/sgml/docbook/xsl-stylesheets/xhtml/docbook.xsl \
+ 		$< \
+ 		>$@.tmp
+ 	mv $@.tmp $@
+@@ -110,8 +110,8 @@ $(SLIDES:%.xml=%/index.html): %/index.html: %.xml \
+ 	addressbook-slides/07_easy/searchform-xhtml.html \
+ 	addressbook-slides/07_easy/addressbook-tac.html
+ 	install -d -m0755 '$(@D)'
+-	cp -ar /usr/share/sgml/docbook/custom/slides/3.2.0/graphics '$(@D)'
+-	cp -ar /usr/share/sgml/docbook/custom/slides/3.2.0/browser '$(@D)'
++	cp -ar /usr/share/xml/docbook/slides/3.4.0/graphics '$(@D)'
++	cp -ar /usr/share/xml/docbook/slides/3.4.0/browser '$(@D)'
+ 	patch '$(@D)/browser/overlay.js' <overlay.js.patch
+ 	cp $(DIAPNG) '$(@D)'
+ 	cp slide-style.css '$(@D)'
+diff --git a/doc/ldap-intro.xml b/doc/ldap-intro.xml
+index 421ffd7..32758bb 100644
+--- a/doc/ldap-intro.xml
++++ b/doc/ldap-intro.xml
+@@ -1,5 +1,5 @@
+ <?xml version='1.0'?>
+-<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V4.2//EN" "/usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd" [
++<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V4.2//EN" "/usr/share/sgml/docbook/xml-dtd-4.2/docbookx.dtd" [
+ 
+ <!ENTITY ldapentry_vs_oo SYSTEM "ldapentry-vs-oo.xml">
+ <!ENTITY search_inputs SYSTEM "search-inputs.xml">
+diff --git a/doc/slides-driver.xsl b/doc/slides-driver.xsl
+index e9fcbf3..2fc965d 100644
+--- a/doc/slides-driver.xsl
++++ b/doc/slides-driver.xsl
+@@ -1,7 +1,7 @@
+ <?xml version="1.0"?>
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ 
+-  <xsl:import href="/usr/share/xml/docbook/custom/slides/3.3.1/xsl/xhtml/default.xsl"/>
++  <xsl:import href="/usr/share/xml/docbook/slides/3.4.0/xsl/xhtml/default.xsl"/>
+   <!-- xsl:import href="slides/xsl/default.xsl"/ -->
+ 
+   <xsl:param name="keyboard.nav">1</xsl:param>
diff --git a/python-ldaptor-remove-webui.patch b/python-ldaptor-remove-webui.patch
new file mode 100644
index 0000000..bcee499
--- /dev/null
+++ b/python-ldaptor-remove-webui.patch
@@ -0,0 +1,190 @@
+Remove webui from setup scripts. The webui is no longer maintained and depends
+on deprecated functions of python-twister-web.
+
+Author: Jan Vcelak <jvcelak at redhat.com>
+
+diff --git a/setup.py b/setup.py
+index cb3246c..d54bad4 100755
+--- a/setup.py
++++ b/setup.py
+@@ -2,125 +2,9 @@
+ 
+ import os, errno
+ from distutils.core import setup
+-from distutils import sysconfig, cmd
+-from distutils.command.build import build as _build
+-from distutils.command.clean import clean as _clean
+-from distutils.command.install import install as _install
+-from distutils.util import change_root
+-from distutils.dir_util import remove_tree, copy_tree, mkpath
+-
+-# quick hack to support generating locale files
+-class build(_build):
+-    def __init__(self, *a, **kw):
+-        self.sub_commands = self.sub_commands + [
+-            ('build_locale', None),
+-            ]
+-        _build.__init__(self, *a, **kw)
+-
+-class build_locale(cmd.Command):
+-    user_options = [
+-        ('build-dir=', 'd', "directory to build to"),
+-        ('po-dir=', 'd', "directory holding the domain dirs and in them PO-files"),
+-        ]
+-
+-    def initialize_options(self):
+-        self.build_dir = 'locale'
+-        self.build_base = None
+-        self.po_dir = 'po'
+-
+-    def finalize_options (self):
+-        self.set_undefined_options('build',
+-                                   ('build_base', 'build_base'))
+-        self.build_dir = change_root(self.build_base, self.build_dir)
+-
+-    def run(self):
+-        for domain in os.listdir(self.po_dir):
+-            try:
+-                l = os.listdir(os.path.join(self.po_dir, domain))
+-            except OSError, e:
+-                if e.errno == errno.ENOTDIR:
+-                    continue
+-                else:
+-                    raise
+-
+-            for po in l:
+-                if not po.endswith('.po'):
+-                    continue
+-                locale = po[:-len('.po')]
+-                path = os.path.join(self.build_dir,
+-                                    locale,
+-                                    'LC_MESSAGES')
+-                mkpath(path)
+-                self.spawn(['msgfmt', '-o',
+-                            os.path.join(path, '%s.mo' % domain),
+-                            os.path.join(self.po_dir,
+-                                         domain,
+-                                         po)])
+-class clean(_clean):
+-    def run(self):
+-        self.run_command('clean_locale')
+-        _clean.run(self)
+-
+-class clean_locale(cmd.Command):
+-    user_options = [
+-        ('build-dir=', 'd', "directory to build to"),
+-        ]
+-
+-    def initialize_options(self):
+-        self.build_dir = None
+-
+-    def finalize_options (self):
+-        self.set_undefined_options('build_locale',
+-                                   ('build_dir', 'build_dir'))
+-
+-    def run(self):
+-        if os.path.exists(self.build_dir):
+-            remove_tree(self.build_dir, dry_run=self.dry_run)
+-
+-class install(_install):
+-    def __init__(self, *a, **kw):
+-        self.sub_commands = self.sub_commands + [
+-            ('install_locale', None),
+-            ]
+-        _install.__init__(self, *a, **kw)
+-
+-class install_locale(cmd.Command):
+-    user_options = [
+-        ('install-dir=', 'd', "directory to install locales to"),
+-        ('build-dir=','b', "build directory (where to install from)"),
+-        ('skip-build', None, "skip the build steps"),
+-        ]
+-
+-    boolean_options = ['skip-build']
+-
+-    def initialize_options(self):
+-        self.build_dir = None
+-        self.install_dir = None
+-        self.root = None
+-        self.prefix = None
+-        self.skip_build = None
+-
+-    def finalize_options (self):
+-        self.set_undefined_options('build_locale',
+-                                   ('build_dir', 'build_dir'))
+-        self.set_undefined_options('install',
+-                                   ('skip_build', 'skip_build'))
+-        if self.install_dir is None:
+-            self.set_undefined_options('install',
+-                                       ('root', 'root'))
+-            self.set_undefined_options('install',
+-                                       ('prefix', 'prefix'))
+-            prefix = self.prefix
+-            if self.root is not None:
+-                prefix = change_root(self.root, prefix)
+-            self.install_dir = os.path.join(prefix, 'share', 'locale')
+-
+-    def run(self):
+-        if not self.skip_build:
+-            self.run_command('build_locale')
+-        copy_tree(src=self.build_dir,
+-                  dst=self.install_dir,
+-                  dry_run=self.dry_run)
++from distutils.command.build import build
++from distutils.command.clean import clean
++from distutils.command.install import install
+ 
+ if __name__=='__main__':
+     setup(name="ldaptor",
+@@ -151,11 +35,8 @@ from the command line.
+ 	  license="GNU LGPL",
+ 
+           cmdclass={'build': build,
+-                    'build_locale': build_locale,
+                     'clean': clean,
+-                    'clean_locale': clean_locale,
+                     'install': install,
+-                    'install_locale': install_locale,
+                     },
+ 
+ 	  packages=[
+@@ -164,12 +45,9 @@ from the command line.
+         "ldaptor.protocols.ldap",
+         "ldaptor.protocols.ldap.autofill",
+ 	"ldaptor.samba",
+-	"ldaptor.apps",
+-	"ldaptor.apps.webui",
+ 	"ldaptor.test",
+ 	],
+ 	  scripts=[
+-	"bin/ldaptor-webui",
+ 	"bin/ldaptor-ldap2dhcpconf",
+ 	"bin/ldaptor-ldap2maradns",
+ 	"bin/ldaptor-ldap2dnszones",
+@@ -184,26 +62,4 @@ from the command line.
+ 	"bin/ldaptor-fetchschema",
+         "bin/ldaptor-ldifdiff",
+         "bin/ldaptor-ldifpatch",
+-	],
+-          data_files=[
+-        (os.path.join(sysconfig.get_python_lib(), 'ldaptor/apps/webui'),
+-         [
+-        'ldaptor/apps/webui/add-really.xhtml',
+-        'ldaptor/apps/webui/add.xhtml',
+-        'ldaptor/apps/webui/basedn.xhtml',
+-        'ldaptor/apps/webui/change_password.xhtml',
+-        'ldaptor/apps/webui/change_service_passwords.xhtml',
+-        'ldaptor/apps/webui/delete-nodn.xhtml',
+-        'ldaptor/apps/webui/delete.xhtml',
+-        'ldaptor/apps/webui/edit-really.xhtml',
+-        'ldaptor/apps/webui/edit.xhtml',
+-        'ldaptor/apps/webui/login.xhtml',
+-        'ldaptor/apps/webui/mass_change_password-really.xhtml',
+-        'ldaptor/apps/webui/mass_change_password.xhtml',
+-        'ldaptor/apps/webui/move.xhtml',
+-        'ldaptor/apps/webui/search.xhtml',
+-
+-        'ldaptor/apps/webui/ldaptor.css',
+-        'ldaptor/apps/webui/skin-default.html',
+-        ]),
+         ])
diff --git a/python-ldaptor.spec b/python-ldaptor.spec
new file mode 100644
index 0000000..db87e7f
--- /dev/null
+++ b/python-ldaptor.spec
@@ -0,0 +1,118 @@
+%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 <jvcelak at redhat.com> 0.0.44-1.20120515git29a06fa
+- initial package
diff --git a/sources b/sources
index e69de29..35415aa 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+5d45e35703d03212a1b1607815f75452  antong-ldaptor-29a06fa.tar.gz


More information about the scm-commits mailing list