Skip to content

Commit

Permalink
Merge pull request #1 from vacanza/python-3.12
Browse files Browse the repository at this point in the history
Add Python 3.12 support
  • Loading branch information
arkid15r authored Mar 8, 2024
2 parents b25c8c1 + e4106b0 commit 15e5164
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:

strategy:
matrix:
python: ['3.7', '3.9', '3.10']
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand All @@ -43,14 +43,14 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@v1
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.12"

- name: Insert version number
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
What is lingva?
===============

This is a fork of package of https://github.com/wichert/lingua
**This is a fork of https://github.com/wichert/lingua**

Lingva is a package with tools to extract translatable texts from
your code, and to check existing translations. It replaces the use
Expand Down
5 changes: 1 addition & 4 deletions src/lingva/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import tempfile
import time

try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
from configparser import ConfigParser as SafeConfigParser
import click
import polib
from lingva.extractors import get_extractor
Expand Down
14 changes: 5 additions & 9 deletions src/lingva/extractors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import print_function
from pkg_resources import DistributionNotFound
from pkg_resources import working_set

from importlib.metadata import entry_points

import abc
import collections
import os
Expand Down Expand Up @@ -162,13 +163,8 @@ def __call__(self, filename, options, fileobj=None, lineno=0):


def register_extractors():
for entry_point in working_set.iter_entry_points("lingva.extractors"):
try:
extractor = entry_point.load(require=True)
except DistributionNotFound:
# skip this entry point since at least one required dependency can
# not be found
extractor = None
for entry_point in entry_points("lingua.extractors"):
extractor = entry_point.load()
if extractor:
if not issubclass(extractor, Extractor):
raise ValueError("Registered extractor must derive from ``Extractor``")
Expand Down
15 changes: 5 additions & 10 deletions src/lingva/extractors/babel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pkg_resources import DistributionNotFound
from pkg_resources import working_set
from importlib.metadata import entry_points

from .python import KEYWORDS
from .python import parse_keyword
from . import EXTRACTORS
Expand Down Expand Up @@ -58,15 +58,10 @@ def __call__(self, filename, options, fileobj=None, firstline=0):


def register_babel_plugins():
for entry_point in working_set.iter_entry_points("babel.extractors"):
name = entry_point.name
try:
extractor = entry_point.load(require=True)
except DistributionNotFound:
# skip this entry point since at least one required dependency can
# not be found
extractor = None
for entry_point in entry_points("babel.extractors"):
extractor = entry_point.load()
if extractor:
name = entry_point.name
cls = type(
"BabelExtractor_%s" % name,
(BabelExtractor, object),
Expand Down
2 changes: 1 addition & 1 deletion tests/extractors/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_function_argument():
options = mock.Mock()
options.keywords = []
options.comment_tag = "I18N:"
source = u"""_('word', func('foo', 2'))"""
source = u"""_('word', func('foo', 2))"""
messages = list(python_extractor("filename", options))
assert len(messages) == 1
assert messages[0].msgid == "word"
Expand Down

0 comments on commit 15e5164

Please sign in to comment.