From 4dc0a93748a2a37444172f328154228a90dd5294 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 18:23:09 +0000 Subject: [PATCH 01/18] Commit --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f6bcfe..dbc6340 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,10 +27,14 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Install dependencies + - name: Install dependencies (macOS) if: runner.os == 'macOS' run: brew install libiconv + - name: Install dependencies (Windows) + if: runner.os == 'Windows' + run: vcpkg install libiconv + - name: Install package run: | python -m pip install --upgrade pip From 39f3e6314ded0e5b732126dd069b8f59516c1bd1 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 18:33:03 +0000 Subject: [PATCH 02/18] Link them --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbc6340..d84e2c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,11 @@ jobs: - name: Install dependencies (Windows) if: runner.os == 'Windows' - run: vcpkg install libiconv + run: | + vcpkg install libiconv + echo "INCLUDE=C:\vcpkg\installed\x64-windows\include;$env:INCLUDE" >> $env:GITHUB_ENV + echo "LIB=C:\vcpkg\installed\x64-windows\lib;$env:LIB" >> $env:GITHUB_ENV + - name: Install package run: | From 40087c356fe357b8fc2975cc0fca1ca41327b43a Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 18:43:53 +0000 Subject: [PATCH 03/18] Add DLLs to path --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d84e2c5..90eaed7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,9 @@ jobs: vcpkg install libiconv echo "INCLUDE=C:\vcpkg\installed\x64-windows\include;$env:INCLUDE" >> $env:GITHUB_ENV echo "LIB=C:\vcpkg\installed\x64-windows\lib;$env:LIB" >> $env:GITHUB_ENV + + # XXX: This seems very hacky + echo "C:\vcpkg\installed\x64-windows\bin" >> $env:GITHUB_PATH - name: Install package From 1ec4480c67c2bc9975f17f742a089ef49b9ba6f3 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 18:54:37 +0000 Subject: [PATCH 04/18] Try more things :-( Who uses Windows anyway... --- .github/workflows/test.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90eaed7..0e784cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,19 +34,20 @@ jobs: - name: Install dependencies (Windows) if: runner.os == 'Windows' run: | - vcpkg install libiconv + vcpkg install libiconv:x64-windows --triplet x64-windows echo "INCLUDE=C:\vcpkg\installed\x64-windows\include;$env:INCLUDE" >> $env:GITHUB_ENV echo "LIB=C:\vcpkg\installed\x64-windows\lib;$env:LIB" >> $env:GITHUB_ENV - - # XXX: This seems very hacky - echo "C:\vcpkg\installed\x64-windows\bin" >> $env:GITHUB_PATH - - name: Install package run: | python -m pip install --upgrade pip pip install -e . + - name: Debug libiconv loc + run: dir "C:\vcpkg\installed\x64-windows\bin" + - name: Run tests run: | + # XXX: This seems very hacky + $env:PATH = "C:\vcpkg\installed\x64-windows\bin;$env:PATH" python -m unittest -v From dfe8986c30d5c059f9c3c4c244c2e97012be1242 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 19:23:50 +0000 Subject: [PATCH 05/18] Rename to libiconv.dll --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e784cc..0f1b3ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,10 +44,13 @@ jobs: pip install -e . - name: Debug libiconv loc + if: runner.os == 'Windows' run: dir "C:\vcpkg\installed\x64-windows\bin" - name: Run tests run: | # XXX: This seems very hacky + Copy-Item "C:\vcpkg\installed\x64-windows\bin\iconv-2.dll" "C:\vcpkg\installed\x64-windows\bin\libiconv.dll" $env:PATH = "C:\vcpkg\installed\x64-windows\bin;$env:PATH" + python -m unittest -v From dc7b27648fe47b523cc4337dddda70eca9e1a6e5 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 19:47:28 +0000 Subject: [PATCH 06/18] Try again --- .github/workflows/test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f1b3ba..da554ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,10 +47,12 @@ jobs: if: runner.os == 'Windows' run: dir "C:\vcpkg\installed\x64-windows\bin" - - name: Run tests + # XXX: This feels a bit hacky + - name: Setup DLLs (Windows) + if: runner.os == 'Windows' run: | - # XXX: This seems very hacky - Copy-Item "C:\vcpkg\installed\x64-windows\bin\iconv-2.dll" "C:\vcpkg\installed\x64-windows\bin\libiconv.dll" - $env:PATH = "C:\vcpkg\installed\x64-windows\bin;$env:PATH" + Copy-Item "C:\vcpkg\installed\x64-windows\bin\iconv-2.dll" "C:\vcpkg\installed\x64-windows\bin\iconv.dll" + echo "C:\vcpkg\installed\x64-windows\bin" >> $env:GITHUB_PATH - python -m unittest -v + - name: Run tests + run: python -m unittest -v From 80c7c7b93c1331e944b238a6066d944e4105e9ae Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:04:14 +0000 Subject: [PATCH 07/18] Try linking again --- .github/workflows/test.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da554ec..d463bb3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,16 +43,13 @@ jobs: python -m pip install --upgrade pip pip install -e . - - name: Debug libiconv loc - if: runner.os == 'Windows' - run: dir "C:\vcpkg\installed\x64-windows\bin" + - name: Run tests + if: runner.os != 'Windows' + run: python -m unittest -v - # XXX: This feels a bit hacky - - name: Setup DLLs (Windows) + - name: Run tests (Windows) if: runner.os == 'Windows' run: | - Copy-Item "C:\vcpkg\installed\x64-windows\bin\iconv-2.dll" "C:\vcpkg\installed\x64-windows\bin\iconv.dll" - echo "C:\vcpkg\installed\x64-windows\bin" >> $env:GITHUB_PATH - - - name: Run tests - run: python -m unittest -v + Copy-Item "C:\vcpkg\installed\x64-windows\bin\iconv-2.dll" "iconv.dll" + Copy-Item "C:\vcpkg\installed\x64-windows\bin\charset-1.dll" "charset-1.dll" + python -m unittest -v From cbf2d4ae51b8eafdbfba3c13d3e2f05752fe0292 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:18:10 +0000 Subject: [PATCH 08/18] Try approach from comment --- .github/workflows/test.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d463bb3..e8108bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,9 +34,14 @@ jobs: - name: Install dependencies (Windows) if: runner.os == 'Windows' run: | - vcpkg install libiconv:x64-windows --triplet x64-windows - echo "INCLUDE=C:\vcpkg\installed\x64-windows\include;$env:INCLUDE" >> $env:GITHUB_ENV - echo "LIB=C:\vcpkg\installed\x64-windows\lib;$env:LIB" >> $env:GITHUB_ENV + curl -L -o libiconv.zip https://github.com/pffang/libiconv-for-Windows/releases/download/1.18/libiconv-for-Windows_prebuilt.zip + Expand-Archive libiconv.zip -DestinationPath libiconv + + $ppath = python -c "import sys; print(sys.base_prefix)" + Copy-Item "libiconv\iconv.h" "$ppath\include\" + New-Item -ItemType Directory -Force -Path "$ppath\libs" + Copy-Item "libiconv\x64\Release\libiconv.lib" "$ppath\libs\iconv.lib" + Copy-Item "libiconv\x64\Release\libiconv.dll" "$ppath\site-packages\" - name: Install package run: | @@ -44,12 +49,4 @@ jobs: pip install -e . - name: Run tests - if: runner.os != 'Windows' run: python -m unittest -v - - - name: Run tests (Windows) - if: runner.os == 'Windows' - run: | - Copy-Item "C:\vcpkg\installed\x64-windows\bin\iconv-2.dll" "iconv.dll" - Copy-Item "C:\vcpkg\installed\x64-windows\bin\charset-1.dll" "charset-1.dll" - python -m unittest -v From 6bed63814efd90a8a49b6f04d673caa74a63ba98 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:19:51 +0000 Subject: [PATCH 09/18] Correct site-packages location --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8108bf..044e89e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: Copy-Item "libiconv\iconv.h" "$ppath\include\" New-Item -ItemType Directory -Force -Path "$ppath\libs" Copy-Item "libiconv\x64\Release\libiconv.lib" "$ppath\libs\iconv.lib" - Copy-Item "libiconv\x64\Release\libiconv.dll" "$ppath\site-packages\" + Copy-Item "libiconv\x64\Release\libiconv.dll" "$ppath\Lib\site-packages\" - name: Install package run: | From eb324d53451570591f5518984a850f2dbb6fcce2 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:23:14 +0000 Subject: [PATCH 10/18] Try putting it in the work dir --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 044e89e..2b3eab5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,4 +49,11 @@ jobs: pip install -e . - name: Run tests + if: runner.os != 'Windows' run: python -m unittest -v + + - name: Run tests (Windows) + if: runner.os == 'Windows' + run: | + Copy-Item "libiconv\x64\Release\libiconv.dll" "iconv.dll" + python -m unittest -v From 4400d55a5402f1ec5b1e82477226b5b4576710f2 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:25:05 +0000 Subject: [PATCH 11/18] Try with libiconv instead --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b3eab5..a0bd64a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,5 +55,5 @@ jobs: - name: Run tests (Windows) if: runner.os == 'Windows' run: | - Copy-Item "libiconv\x64\Release\libiconv.dll" "iconv.dll" + Copy-Item "libiconv\x64\Release\libiconv.dll" "libiconv.dll" python -m unittest -v From aeaa08e00797914d984a6923ceb410c580d955f4 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:27:44 +0000 Subject: [PATCH 12/18] Try something else for once --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4c52001..6ac560a 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ if sys.platform.startswith('linux'): libraries = [] else: - libraries = ["iconv"] + libraries = ["libiconv"] setup( name="python-iconv", From ae6a6e9879edf395c61f045bafc787c59a3792c0 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:30:02 +0000 Subject: [PATCH 13/18] Try something else for once --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a0bd64a..a86eb8e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: $ppath = python -c "import sys; print(sys.base_prefix)" Copy-Item "libiconv\iconv.h" "$ppath\include\" New-Item -ItemType Directory -Force -Path "$ppath\libs" - Copy-Item "libiconv\x64\Release\libiconv.lib" "$ppath\libs\iconv.lib" + Copy-Item "libiconv\x64\Release\libiconv.lib" "$ppath\libs\libiconv.lib" Copy-Item "libiconv\x64\Release\libiconv.dll" "$ppath\Lib\site-packages\" - name: Install package From 697aecbd86d6b959a507b17abaef120ab843ab81 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:31:20 +0000 Subject: [PATCH 14/18] Revert that --- .github/workflows/test.yml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a86eb8e..a0bd64a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: $ppath = python -c "import sys; print(sys.base_prefix)" Copy-Item "libiconv\iconv.h" "$ppath\include\" New-Item -ItemType Directory -Force -Path "$ppath\libs" - Copy-Item "libiconv\x64\Release\libiconv.lib" "$ppath\libs\libiconv.lib" + Copy-Item "libiconv\x64\Release\libiconv.lib" "$ppath\libs\iconv.lib" Copy-Item "libiconv\x64\Release\libiconv.dll" "$ppath\Lib\site-packages\" - name: Install package diff --git a/setup.py b/setup.py index 6ac560a..4c52001 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ if sys.platform.startswith('linux'): libraries = [] else: - libraries = ["libiconv"] + libraries = ["iconv"] setup( name="python-iconv", From 67567c4c766d922789565ac2ea980889ba5cee04 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:34:48 +0000 Subject: [PATCH 15/18] Tidy up running tests --- .github/workflows/test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a0bd64a..044e89e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,11 +49,4 @@ jobs: pip install -e . - name: Run tests - if: runner.os != 'Windows' run: python -m unittest -v - - - name: Run tests (Windows) - if: runner.os == 'Windows' - run: | - Copy-Item "libiconv\x64\Release\libiconv.dll" "libiconv.dll" - python -m unittest -v From 5820a158dcc3f5c00a0dc6d6be4bd229b6f5aae7 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 20:36:15 +0000 Subject: [PATCH 16/18] Also revert that --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 044e89e..a0bd64a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,4 +49,11 @@ jobs: pip install -e . - name: Run tests + if: runner.os != 'Windows' run: python -m unittest -v + + - name: Run tests (Windows) + if: runner.os == 'Windows' + run: | + Copy-Item "libiconv\x64\Release\libiconv.dll" "libiconv.dll" + python -m unittest -v From 950d7167cdfa91dd5ab33af49c0275162a2acb54 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 21:43:48 +0000 Subject: [PATCH 17/18] Patch tests --- test_iconvcodec.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test_iconvcodec.py b/test_iconvcodec.py index 6a38963..9e7f18a 100644 --- a/test_iconvcodec.py +++ b/test_iconvcodec.py @@ -1,9 +1,11 @@ import unittest import iconvcodec import codecs +import sys class TestIconvcodecModule(unittest.TestCase): + @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") def test_encode(self): bytestring = "Hallo".encode("T.61") self.assertEqual(bytestring, b"Hallo") @@ -11,12 +13,17 @@ def test_encode(self): def test_encode_with_long_out(self): """Edge case where output has more bytes than input as utf-8""" bytestring = "™".encode("ASCII//TRANSLIT") - self.assertEqual(bytestring, b"(TM)") + if sys.platform.startswith('linux'): + self.assertEqual(bytestring, b"(TM)") + else: + self.assertEqual(bytestring, b"TM") + @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") def test_decode(self): string = b"Hallo".decode("T.61") self.assertEqual(string, "Hallo") + @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") def test_transliterate(self): string = "abc ß α € àḃç" bytestring = string.encode("ASCII//TRANSLIT") @@ -30,6 +37,7 @@ def test_incremental_encode(self): self.assertEqual(first, b"Foo") self.assertEqual(second, b"bar") + @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") def test_incremental_decode(self): decoder = codecs.getincrementaldecoder("UCS2")() first = decoder.decode(b"\x41") From 1f064a0618dee0cdf145d1c1f164ffe17b8a10b6 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sat, 1 Nov 2025 21:45:14 +0000 Subject: [PATCH 18/18] Lint --- test_iconvcodec.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test_iconvcodec.py b/test_iconvcodec.py index 9e7f18a..aaa5bc9 100644 --- a/test_iconvcodec.py +++ b/test_iconvcodec.py @@ -5,7 +5,7 @@ class TestIconvcodecModule(unittest.TestCase): - @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") + @unittest.skipUnless(sys.platform.startswith("linux"), "Linux only test") def test_encode(self): bytestring = "Hallo".encode("T.61") self.assertEqual(bytestring, b"Hallo") @@ -13,17 +13,17 @@ def test_encode(self): def test_encode_with_long_out(self): """Edge case where output has more bytes than input as utf-8""" bytestring = "™".encode("ASCII//TRANSLIT") - if sys.platform.startswith('linux'): + if sys.platform.startswith("linux"): self.assertEqual(bytestring, b"(TM)") else: self.assertEqual(bytestring, b"TM") - @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") + @unittest.skipUnless(sys.platform.startswith("linux"), "Linux only test") def test_decode(self): string = b"Hallo".decode("T.61") self.assertEqual(string, "Hallo") - @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") + @unittest.skipUnless(sys.platform.startswith("linux"), "Linux only test") def test_transliterate(self): string = "abc ß α € àḃç" bytestring = string.encode("ASCII//TRANSLIT") @@ -37,7 +37,7 @@ def test_incremental_encode(self): self.assertEqual(first, b"Foo") self.assertEqual(second, b"bar") - @unittest.skipUnless(sys.platform.startswith('linux'), "Linux only test") + @unittest.skipUnless(sys.platform.startswith("linux"), "Linux only test") def test_incremental_decode(self): decoder = codecs.getincrementaldecoder("UCS2")() first = decoder.decode(b"\x41")