New Upstream Release - utidylib

Ready changes

Summary

Merged new upstream version: 0.9 (was: 0.8).

Resulting package

Built on 2022-12-30T15:09 (took 4m53s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases python3-utidylib

Lintian Result

Diff

diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml
index a7dcbae..4552bc7 100644
--- a/.github/workflows/flake8.yml
+++ b/.github/workflows/flake8.yml
@@ -12,15 +12,15 @@ jobs:
     runs-on: ubuntu-20.04
 
     steps:
-      - uses: actions/checkout@v2.3.4
-      - uses: actions/cache@v2.1.6
+      - uses: actions/checkout@v3
+      - uses: actions/cache@v3
         with:
           path: |
             ~/.cache/pip
             ~/.cache/pre-commit
           key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements*.txt') }}-${{ hashFiles('.pre-commit-config.yaml') }}
       - name: Setup Python
-        uses: actions/setup-python@v2.2.2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.9
       - name: Install dependencies
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 5a34e23..af06b7e 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -12,15 +12,15 @@ jobs:
     runs-on: ubuntu-20.04
 
     steps:
-      - uses: actions/checkout@v2.3.4
-      - uses: actions/cache@v2.1.6
+      - uses: actions/checkout@v3
+      - uses: actions/cache@v3
         with:
           path: |
             ~/.cache/pip
             ~/.cache/pre-commit
           key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/requirements*.txt') }}-${{ hashFiles('.pre-commit-config.yaml') }}
       - name: Setup Python
-        uses: actions/setup-python@v2.2.2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.9
       - name: Install dependencies
diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml
index 86f31aa..0486399 100644
--- a/.github/workflows/setup.yml
+++ b/.github/workflows/setup.yml
@@ -7,13 +7,13 @@ jobs:
     runs-on: ubuntu-20.04
 
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/cache@v2.1.6
+      - uses: actions/checkout@v3
+      - uses: actions/cache@v3
         with:
           path: ~/.cache/pip
           key: ${{ runner.os }}-pip-setup-${{ hashFiles('**/requirements*.txt') }}
       - name: Setup Python
-        uses: actions/setup-python@v2.2.2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.8
       - name: Install dependencies
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 4cab155..2922543 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -6,29 +6,41 @@ jobs:
   test:
     runs-on: ${{ matrix.os }}
     strategy:
+      fail-fast: false
       matrix:
-        os: [ubuntu-20.04, macos-latest]
-        python-version: [3.6, 3.7, 3.8, 3.9]
-        exclude:
-          - os: macos-latest
-            python-version: 3.6
-          - os: macos-latest
-            python-version: 3.9
-    name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
+        os:
+          - ubuntu-22.04
+          - macos-latest
+        python-version:
+          - "3.7"
+          - "3.8"
+          - "3.9"
+          - "3.10"
+          - "3.11"
+        tidy-version:
+          - "5.6.0"
+        include:
+          - os: ubuntu-22.04
+            python-version: "3.11"
+            tidy-version: "5.8.0"
+          - os: ubuntu-20.04
+            python-version: "3.11"
+            tidy-version: "os"
+    name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, tidy ${{ matrix.tidy-version }}
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v3
       - name: Cache pip
-        uses: actions/cache@v2.1.6
+        uses: actions/cache@v3
         with:
           path: ~/.cache/pip
           key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v2.2.2
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
       - name: Install tidy
-        run: ./scripts/install-tidy.sh 5.6.0
+        run: ./scripts/install-tidy.sh ${{ matrix.tidy-version }}
       - name: Install pip dependencies
         run: |
           python -m pip install --upgrade pip wheel
@@ -39,8 +51,12 @@ jobs:
       - name: Coverage
         run: |
           coverage xml
-      - uses: codecov/codecov-action@v2.1.0
+      - name: Install editable
+        run: pip install -e .
+      - name: Check used library
+        run: python -c 'import tidy.lib; print(tidy.lib._tidy.lib._name, tidy.lib.getTidyVersion())'
+      - uses: codecov/codecov-action@v3
         with:
           token: ${{secrets.CODECOV_TOKEN}}
           flags: unittests
-          name: Python ${{ matrix.python-version }}, ${{ matrix.os }}
+          name: Python ${{ matrix.python-version }}, ${{ matrix.os }}, tidy ${{ matrix.tidy-version }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6152c27..e8f9edb 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,7 @@
 # See https://pre-commit.com/hooks.html for more hooks
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.0.1
+    rev: v4.2.0
     hooks:
       - id: trailing-whitespace
       - id: end-of-file-fixer
@@ -18,20 +18,20 @@ repos:
     hooks:
       - id: yamllint
   - repo: https://github.com/pycqa/isort
-    rev: 5.9.3
+    rev: 5.10.1
     hooks:
       - id: isort
   - repo: https://github.com/asottile/pyupgrade
-    rev: v2.29.0
+    rev: v2.32.0
     hooks:
       - id: pyupgrade
         args: [--py36-plus]
   - repo: https://github.com/psf/black
-    rev: 21.9b0
+    rev: 22.3.0
     hooks:
       - id: black
   - repo: https://github.com/PyCQA/flake8
-    rev: 3.9.2
+    rev: 4.0.1
     hooks:
       - id: flake8
         additional_dependencies:
@@ -50,7 +50,7 @@ repos:
           - flake8-self
           - pep8-naming
   - repo: https://github.com/asottile/blacken-docs
-    rev: v1.11.0
+    rev: v1.12.1
     hooks:
       - id: blacken-docs
   - repo: meta
diff --git a/CHANGES.rst b/CHANGES.rst
index 8f87d20..7a83617 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,15 @@
 Changes
 =======
 
+0.9
+---
+
+* Dropped support for Python 3.6.
+* Added support for Python 3.10 and 3.11.
+* Compatibility with html-tidy 5.8.0.
+* Added support for specifying library full path using TIDY_LIBRARY_FULL_PATH.
+* Added getTidyVersion to get libtidy version.
+
 0.8
 ---
 
diff --git a/debian/changelog b/debian/changelog
index 238897f..fbff23b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+utidylib (0.9-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Fri, 30 Dec 2022 15:05:15 -0000
+
 utidylib (0.8-1) unstable; urgency=medium
 
   * Team upload.
diff --git a/requirements-lint.txt b/requirements-lint.txt
index faf5986..6c35d69 100644
--- a/requirements-lint.txt
+++ b/requirements-lint.txt
@@ -1,2 +1,2 @@
-pre-commit==2.15.0
+pre-commit==2.20.0
 twine
diff --git a/scripts/install-tidy.sh b/scripts/install-tidy.sh
index b587b81..bcd5304 100755
--- a/scripts/install-tidy.sh
+++ b/scripts/install-tidy.sh
@@ -7,10 +7,22 @@ if [ -z "$1" ] ; then
     exit 1
 fi
 
+CMAKE_ARGS=""
+if which apt-get ; then
+  if [ "$1" = "os" ] ; then
+    sudo apt-get install -y libtidy5deb1
+    exit 0
+  else
+    sudo apt-get purge libtidy5deb1 tidy libtidy-dev
+  fi
+  CMAKE_ARGS="-DCMAKE_INSTALL_PREFIX=/usr"
+fi
+
 wget -O tidy.tar.gz https://github.com/htacg/tidy-html5/archive/$1.tar.gz
 mkdir tidy-source
 tar xvf tidy.tar.gz --strip-components=1 -C tidy-source
 rm tidy.tar.gz
 cd tidy-source/build/cmake/
-cmake ../.. -DCMAKE_BUILD_TYPE=Release
+cmake ../.. -DCMAKE_BUILD_TYPE=Release $CMAKE_ARGS
 make
+sudo make install
diff --git a/setup.cfg b/setup.cfg
index 896c22b..eb1b458 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = uTidylib
-version = 0.8
+version = 0.9
 author = Michal Čihař
 author_email = michal@cihar.com
 license = MIT
@@ -10,6 +10,7 @@ project_urls =
     Issue Tracker=https://github.com/nijel/utidylib/issues
     Documentation=https://utidylib.readthedocs.io/
     Source Code=https://github.com/nijel/utidylib
+    Funding=https://liberapay.com/nijel
 download_url = https://github.com/nijel/utidylib
 long_description = file: README.rst
 long_description_content_type = text/x-rst
@@ -22,14 +23,15 @@ classifiers =
     Programming Language :: Python
     Programming Language :: Python :: 3
     Programming Language :: Python :: 3 :: Only
-    Programming Language :: Python :: 3.6
     Programming Language :: Python :: 3.7
     Programming Language :: Python :: 3.8
     Programming Language :: Python :: 3.9
+    Programming Language :: Python :: 3.10
+    Programming Language :: Python :: 3.11
 
 [options]
 packages = tidy
-python_requires = >=3.6
+python_requires = >=3.7
 include_package_data = 1
 
 [options.package_data]
diff --git a/tidy/lib.py b/tidy/lib.py
index 6ce20c7..e01c474 100644
--- a/tidy/lib.py
+++ b/tidy/lib.py
@@ -22,6 +22,8 @@ LIBNAMES = (
     "libtidy-0.99.so.0.0.0",
     # HTML tidy
     "libtidy.so.5",
+    # Linux, HTML tidy v5.8
+    "libtidy.so.58",
     # Debian changed soname
     "libtidy.so.5deb1",
     # Windows?
@@ -45,6 +47,11 @@ class Loader:
             (os.path.dirname(__file__), os.pathsep, os.environ["PATH"])
         )
 
+        # Add full path to a library
+        lib_path = os.environ.get("TIDY_LIBRARY_FULL_PATH")
+        if lib_path:
+            self.libnames = (lib_path,) + self.libnames
+
         # Try loading library
         for libname in self.libnames:
             try:
@@ -60,6 +67,7 @@ class Loader:
         # Adjust some types
         if self.lib is not None:
             self.Create.restype = ctypes.POINTER(ctypes.c_void_p)
+            self.LibraryVersion.restype = ctypes.c_char_p
 
     def __getattr__(self, name):
         return getattr(self.lib, "tidy%s" % name)
@@ -317,3 +325,7 @@ class DocumentFactory(FactoryDict):
 docfactory = DocumentFactory()
 parse = docfactory.parse
 parseString = docfactory.parseString
+
+
+def getTidyVersion():
+    return _tidy.lib.tidyLibraryVersion().decode()
diff --git a/tidy/test_tidy.py b/tidy/test_tidy.py
index f1a1d0d..83c7113 100644
--- a/tidy/test_tidy.py
+++ b/tidy/test_tidy.py
@@ -115,3 +115,22 @@ class TidyTestCase(unittest.TestCase):
     def test_missing_load(self):
         with self.assertRaises(OSError):
             tidy.lib.Loader(libnames=("not-existing-library",))
+
+    def test_lib_from_environ(self):
+        os.environ["TIDY_LIBRARY_FULL_PATH"] = "/foo/bar/tidy"
+        loader = tidy.lib.Loader()
+        expected_libnames = (
+            "/foo/bar/tidy",
+            "libtidy.so",
+            "libtidy.dylib",
+            "tidy",
+            "cygtidy-0-99-0",
+            "libtidy-0.99.so.0",
+            "libtidy-0.99.so.0.0.0",
+            "libtidy.so.5",
+            "libtidy.so.58",
+            "libtidy.so.5deb1",
+            "libtidy",
+            "tidylib",
+        )
+        self.assertEqual(loader.libnames, expected_libnames)

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/lib/python3/dist-packages/uTidylib-0.9.egg-info/PKG-INFO
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/uTidylib-0.9.egg-info/dependency_links.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/uTidylib-0.9.egg-info/top_level.txt

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/lib/python3/dist-packages/uTidylib-0.8.egg-info/PKG-INFO
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/uTidylib-0.8.egg-info/dependency_links.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/uTidylib-0.8.egg-info/top_level.txt

No differences were encountered in the control files

More details

Full run details