Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v5
with:
persist-credentials: false

- uses: actions/setup-python@v6
with:
python-version: "3.x"

- uses: pre-commit/action@v3.0.1
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: mixed-line-ending
7 changes: 4 additions & 3 deletions iconvcodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ def _iconv_decode_impl(decoder, msg, errors, bufsize=None):

def codec_factory(encoding):
# Workaround for https://github.com/bodograumann/python-iconv/issues/4
_encoding = encoding \
.replace("_translit", "//TRANSLIT") \
.replace("_ignore", "//IGNORE") \
_encoding = (
encoding.replace("_translit", "//TRANSLIT")
.replace("_ignore", "//IGNORE")
.replace("_non_identical_discard", "//NON_IDENTICAL_DISCARD")
)

encoder = iconv.open(_encoding, "utf-8")
decoder = iconv.open("utf-8", _encoding)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# On Linux, iconv is part of glibc and doesn't need separate linkage
# Otherwise, link against libiconv
if sys.platform.startswith('linux'):
if sys.platform.startswith("linux"):
libraries = []
else:
libraries = ["iconv"]
Expand Down
Loading