[Python-modules-commits] [python-tidylib] 06/08: Add a patch to use ctypes.util.find_library function.

Dmitry Shachnev mitya57 at moszumanska.debian.org
Sun Sep 25 10:58:36 UTC 2016


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch master
in repository python-tidylib.

commit 1af0c613882e20d76b87fb9da0554837f1be85f8
Merge: a6b4366 d0fdad9
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Sun Sep 25 13:41:25 2016 +0300

    Add a patch to use ctypes.util.find_library function.
    
    Instead of the hard-coded list of library names.
    Closes: #838197.

 debian/.git-dpm                            |  4 +-
 debian/changelog                           |  2 +
 debian/patches/0002-Use-find_library.patch | 70 ++++++++++++++++++++++++++++++
 debian/patches/series                      |  1 +
 tidylib/tidy.py                            | 27 ++++--------
 5 files changed, 84 insertions(+), 20 deletions(-)

diff --cc debian/.git-dpm
index 723b35b,0000000..5c5fbbb
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
 +# see git-dpm(1) from git-dpm package
- 686af3f015afb6de9a65d94deb0b920a91c5c1ed
- 686af3f015afb6de9a65d94deb0b920a91c5c1ed
++d0fdad94d8fa84babb23a9bfe9d8945b811c2aec
++d0fdad94d8fa84babb23a9bfe9d8945b811c2aec
 +678ef50477d8d385a9da3da4e2a327e5a8388aff
 +678ef50477d8d385a9da3da4e2a327e5a8388aff
 +python-tidylib_0.3.0~dfsg.orig.tar.gz
 +f57c601241a6c1db70625ab2dd94d49be2e4c5a3
 +10004
 +debianTag="debian/%e%v"
 +patchedTag="patched/%e%v"
 +upstreamTag="upstream/%e%u"
diff --cc debian/changelog
index a275313,0000000..e1bd481
mode 100644,000000..100644
--- a/debian/changelog
+++ b/debian/changelog
@@@ -1,88 -1,0 +1,90 @@@
 +python-tidylib (0.3.0~dfsg-1) UNRELEASED; urgency=medium
 +
 +  * New upstream release.
++  * Add a patch to use ctypes.util.find_library instead of the hard-coded
++    list of library names (0002-Use-find_library.patch, closes: #838197).
 +
 + -- Dmitry Shachnev <mitya57 at debian.org>  Sun, 25 Sep 2016 13:37:46 +0300
 +
 +python-tidylib (0.2.4~dfsg-4) unstable; urgency=medium
 +
 +  * Team upload.
 +  * Also change python3-tidylib's dependency over to libtidy5.
 +
 + -- Mattia Rizzolo <mattia at debian.org>  Tue, 13 Sep 2016 21:01:30 +0000
 +
 +python-tidylib (0.2.4~dfsg-3) unstable; urgency=medium
 +
 +  * Team upload.
 +
 +  [ Ondřej Nový ]
 +  * Fixed VCS URL (https).
 +
 +  [ Jeremy Bicha ]
 +  * debian/control:
 +    - Build-Depend on libtidy-dev.
 +    - Depend on libtidy5 instead of libtidy-0.99-0.
 +    - Build-depend on texlive-generic-extra for iftex.sty.  Closes: #828900
 +
 +  [ Dmitry Shachnev ]
 +  * Make the tests pass with tidylib 5.  Closes: #829178
 +
 +  [ Mattia Rizzolo ]
 +  * Bump Standards-Version to 3.9.8, no changes needed.
 +  * Bump debhelper compat level to 10.
 +
 + -- Mattia Rizzolo <mattia at debian.org>  Tue, 13 Sep 2016 08:34:17 +0000
 +
 +python-tidylib (0.2.4~dfsg-2) unstable; urgency=medium
 +
 +  * Team upload.
 +  * Rename doc-base file to avoid file conflict with old python-tidylib
 +    versions (closes: #808322).
 +
 + -- Dmitry Shachnev <mitya57 at debian.org>  Sun, 07 Feb 2016 21:31:24 +0300
 +
 +python-tidylib (0.2.4~dfsg-1) unstable; urgency=low
 +
 +  * Team upload, with maintainer's permission.
 +
 +  [ Jakub Wilk ]
 +  * Use canonical URIs for Vcs-* fields.
 +  * Remove DM-Upload-Allowed; it's no longer used by the archive
 +    software.
 +
 +  [ Janos Guljas ]
 +  * Run tests during build. (Closes: #711078)
 +    - Build depend on libtidy-0.99-0.
 +  * Change my email address.
 +  * Update copyright year in debian/copyright.
 +
 +  [ Dmitry Shachnev ]
 +  * New upstream release.
 +  * Update debian/watch.
 +  * Exclude docs/html directory from the tarball, as it contains minified JS
 +    files without source.
 +  * Switch to pybuild buildsystem and build a python3-tidylib package
 +    (closes: #756001).
 +  * Split the docs into a separate pytidylib-doc package.
 +  * Use dh_sphinxdoc to symlink JavaScript files in the documentation.
 +  * Prevent pytidylib.pdf from being compressed by dh_compress.
 +  * Update debian/copyright.
 +  * Bump Standards-Version to 3.9.6, no changes needed.
 +  * Export PYTHONPATH when calling sphinx-build, so that autofunction
 +    directive works.
 +
 + -- Dmitry Shachnev <mitya57 at debian.org>  Mon, 14 Dec 2015 22:00:41 +0300
 +
 +python-tidylib (0.2.1~dfsg-2) unstable; urgency=low
 +
 +  * Add libjs-underscore dependency and link to replace embeded
 +    copy underscore.js file.
 +  * Add DM-Upload-Allowed control field.
 +
 + -- Janos Guljas <janos at resenje.org>  Mon, 26 Dec 2011 22:46:46 +0100
 +
 +python-tidylib (0.2.1~dfsg-1) unstable; urgency=low
 +
 +  * Initial release. (Closes: #623016)
 +
 + -- Janos Guljas <janos at resenje.org>  Fri, 29 Apr 2011 00:03:51 +0200
diff --cc debian/patches/0002-Use-find_library.patch
index 0000000,0000000..c276067
new file mode 100644
--- /dev/null
+++ b/debian/patches/0002-Use-find_library.patch
@@@ -1,0 -1,0 +1,70 @@@
++From d0fdad94d8fa84babb23a9bfe9d8945b811c2aec Mon Sep 17 00:00:00 2001
++From: Dmitry Shachnev <mitya57 at gmail.com>
++Date: Sun, 25 Sep 2016 13:32:27 +0300
++Subject: Use ctypes.util.find_library instead of hard-coded names list
++
++Forwarded: https://github.com/countergram/pytidylib/pull/16
++Patch-Name: 0002-Use-find_library.patch
++---
++ tidylib/tidy.py | 27 +++++++++------------------
++ 1 file changed, 9 insertions(+), 18 deletions(-)
++
++diff --git a/tidylib/tidy.py b/tidylib/tidy.py
++index a71ae9f..de15252 100644
++--- a/tidylib/tidy.py
+++++ b/tidylib/tidy.py
++@@ -19,6 +19,7 @@
++ # THE SOFTWARE.
++ 
++ import ctypes
+++import ctypes.util
++ import threading
++ import platform
++ import warnings
++@@ -27,10 +28,6 @@ from .sink import create_sink, destroy_sink
++ 
++ __all__ = ['Tidy', 'PersistentTidy']
++ 
++-# Default search order for library names if nothing is passed in
++-LIB_NAMES = ['libtidy', 'libtidy.so', 'libtidy-0.99.so.0', 'cygtidy-0-99-0',
++-             'tidylib', 'libtidy.dylib', 'tidy']
++-
++ # Error code from library
++ ENOMEM = -12
++ 
++@@ -80,18 +77,12 @@ class Tidy(object):
++     """ Wrapper around the HTML Tidy library for cleaning up possibly invalid
++     HTML and XHTML. """
++ 
++-    def __init__(self, lib_names=LIB_NAMES):
++-        lib_names = lib_names if isinstance(lib_names, list) else [lib_names]
++-        for name in lib_names:
++-            try:
++-                self._tidy = load_library(name)
++-                break
++-            except OSError:
++-                continue
++-        if self._tidy is None:
++-            raise OSError(
++-                "Could not load libtidy using any of these names: "
++-                + ",".join(lib_names))
+++    def __init__(self, lib_name=None):
+++        if lib_name is None:
+++            lib_name = ctypes.util.find_library('tidy')
+++        if lib_name is None:
+++            raise OSError("Could not locate libtidy")
+++        self._tidy = load_library(lib_name)
++         self._tidy.tidyCreate.restype = ctypes.POINTER(ctypes.c_void_p)  # Fix for 64-bit systems
++ 
++     @contextmanager
++@@ -194,8 +185,8 @@ class PersistentTidy(Tidy):
++     automatically set. Thread-local storage is used for the document object
++     (one document per thread). """
++ 
++-    def __init__(self, lib_names=LIB_NAMES):
++-        Tidy.__init__(self, lib_names)
+++    def __init__(self, lib_name=None):
+++        Tidy.__init__(self, lib_name)
++         self._local = threading.local()
++         self._local.doc = self._tidy.tidyCreate()
++ 
diff --cc debian/patches/series
index a9ca0f6,0000000..ca2337d
mode 100644,000000..100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@@ -1,1 -1,0 +1,2 @@@
 +0001-Make-the-tests-pass-with-tidylib-5-fixes-13.patch
++0002-Use-find_library.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-tidylib.git



More information about the Python-modules-commits mailing list