Skip to content

Commit cc05c07

Browse files
committed
Fixed dependency to removed crypt module (2)
1 parent 46748f2 commit cc05c07

File tree

5 files changed

+37
-44
lines changed

5 files changed

+37
-44
lines changed

.github/workflows/python-package.yml renamed to .github/workflows/publish-package.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: [ubuntu-latest]
22-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
22+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2323
steps:
2424
- uses: actions/checkout@v3
2525
- name: Set up Python ${{ matrix.python-version }}
@@ -77,3 +77,30 @@ jobs:
7777
with:
7878
github_token: ${{ secrets.github_token }}
7979
branch: ${{ github.ref }}
80+
deploy:
81+
runs-on: ubuntu-latest
82+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
83+
steps:
84+
- uses: actions/checkout@v3
85+
with:
86+
fetch-depth: 0
87+
- name: Check for version change
88+
uses: dorny/paths-filter@v2
89+
id: filter
90+
with:
91+
filters: |
92+
version:
93+
- '**/VERSION.txt'
94+
- if: steps.filter.outputs.version == 'true'
95+
name: Cleanup README
96+
run: |
97+
sed -ri 's/^(##*)\s*:.*:\s*/\1 /g' README.md
98+
awk '{if (match($0,"## Supporters")) exit; print}' README.md > README
99+
mv -f README README.md
100+
- run: python3 -m pip install --upgrade build && python3 -m build
101+
- name: Upload ${{ env.package }} to PyPI
102+
uses: pypa/gh-action-pypi-publish@release/v1
103+
with:
104+
password: ${{ secrets.PYPI_API_TOKEN }}
105+
verbose: true
106+
verify_metadata: false

.github/workflows/pypi-publish.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/codext/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.15.5
1+
1.15.6

src/codext/__common__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def add_macro(mname, *encodings):
370370
:param mname: macro name
371371
:param encodings: encoding names of the encodings to be chained with the macro
372372
"""
373-
global PERS_MACROS
373+
global PERS_MACROS # noqa: F824
374374
# check for name clash with alreday existing macros and codecs
375375
if mname in MACROS or mname in PERS_MACROS:
376376
raise ValueError("Macro name already exists")
@@ -630,7 +630,7 @@ def __get_value(token, position, case_changed=False):
630630

631631
def clear():
632632
""" Clear codext's local registry of search functions. """
633-
global __codecs_registry, MACROS, PERS_MACROS
633+
global __codecs_registry, MACROS, PERS_MACROS # noqa: F824
634634
__codecs_registry, MACROS, PERS_MACROS = [], {}, {}
635635
codecs.clear = clear
636636

@@ -733,7 +733,7 @@ def list_macros():
733733
def remove(name):
734734
""" Remove all search functions matching the input encoding name from codext's local registry or any macro with the
735735
given name. """
736-
global __codecs_registry, MACROS, PERS_MACROS
736+
global __codecs_registry, MACROS, PERS_MACROS # noqa: F824
737737
tbr = []
738738
for search_function in __codecs_registry:
739739
if search_function(name) is not None:
@@ -764,7 +764,7 @@ def remove(name):
764764

765765
def reset():
766766
""" Reset codext's local registry of search functions and macros. """
767-
global __codecs_registry, CODECS_REGISTRY, MACROS, PERS_MACROS
767+
global __codecs_registry, CODECS_REGISTRY, MACROS, PERS_MACROS # noqa: F824
768768
clear()
769769
d = os.path.dirname(__file__)
770770
for pkg in sorted(os.listdir(d)):

tests/test_manual.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ def test_codec_hash_functions(self):
125125
self.assertIsNotNone(codecs.encode(STR, h))
126126
self.assertRaises(NotImplementedError, codecs.decode, STR, h)
127127
if UNIX:
128-
import crypt
128+
try:
129+
import crypt
130+
except ImportError:
131+
import legacycrypt as crypt
129132
METHODS = [x[7:].lower() for x in crypt.__dict__ if x.startswith("METHOD_")]
130133
for m in METHODS:
131134
h = "crypt-" + m

0 commit comments

Comments
 (0)