Hello community,
here is the log from the commit of package python-translation-finder for
openSUSE:Factory checked in at 2020-04-15 19:56:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-translation-finder (Old)
and /work/SRC/openSUSE:Factory/.python-translation-finder.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-translation-finder"
Wed Apr 15 19:56:13 2020 rev:9 rq:794138 version:2.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-translation-finder/python-translation-finder.changes
2020-03-11 18:56:01.259692980 +0100
+++
/work/SRC/openSUSE:Factory/.python-translation-finder.new.2738/python-translation-finder.changes
2020-04-15 19:56:16.701653533 +0200
@@ -1,0 +2,8 @@
+Wed Apr 15 09:43:07 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Update to 2.0:
+ * Dropped support for Python 2.
+ * Improved i18next detection.
+ * Improved detection of monolingual templates.
+
+-------------------------------------------------------------------
Old:
----
1.8.tar.gz
New:
----
2.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-translation-finder.spec ++++++
--- /var/tmp/diff_new_pack.6vGpfS/_old 2020-04-15 19:56:17.981654494 +0200
+++ /var/tmp/diff_new_pack.6vGpfS/_new 2020-04-15 19:56:17.985654497 +0200
@@ -19,8 +19,9 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define modname translation-finder
+%define skip_python2 1
Name: python-translation-finder
-Version: 1.8
+Version: 2.0
Release: 0
Summary: Translation Files Finder
License: GPL-3.0-or-later
@@ -28,27 +29,19 @@
# test_data/linked has to be symlink, hance using github tar ball
Source:
https://github.com/WeblateOrg/translation-finder/archive/%{version}.tar.gz
BuildRequires: %{python_module chardet}
-BuildRequires: %{python_module clint}
-BuildRequires: %{python_module pytest-runner}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests-toolbelt}
BuildRequires: %{python_module ruamel.yaml}
BuildRequires: %{python_module setuptools}
-BuildRequires: %{python_module six}
BuildRequires: %{python_module twine}
BuildRequires: fdupes
-BuildRequires: python-pathlib2
BuildRequires: python-rpm-macros
Requires: python-chardet
Requires: python-ruamel.yaml
Requires: python-setuptools
-Requires: python-six
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
-%ifpython2
-Requires: python-pathlib2
-%endif
%python_subpackages
%description
@@ -56,6 +49,7 @@
%prep
%setup -q -n %{modname}-%{version}
+sed -i -e '/pytest-runner/d' setup.py
%build
%python_build
++++++ 1.8.tar.gz -> 2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.github/matchers/flake8.json
new/translation-finder-2.0/.github/matchers/flake8.json
--- old/translation-finder-1.8/.github/matchers/flake8.json 1970-01-01
01:00:00.000000000 +0100
+++ new/translation-finder-2.0/.github/matchers/flake8.json 2020-04-14
13:18:52.000000000 +0200
@@ -0,0 +1,17 @@
+{
+ "problemMatcher": [
+ {
+ "owner": "flake8",
+ "pattern": [
+ {
+ "regexp": "^([^:]*):(\\d+):(\\d+): (\\w+\\d\\d\\d) (.*)$",
+ "file": 1,
+ "line": 2,
+ "column": 3,
+ "code": 4,
+ "message": 5
+ }
+ ]
+ }
+ ]
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.github/workflows/closing.yml
new/translation-finder-2.0/.github/workflows/closing.yml
--- old/translation-finder-1.8/.github/workflows/closing.yml 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/.github/workflows/closing.yml 2020-04-14
13:18:52.000000000 +0200
@@ -1,3 +1,5 @@
+name: Issue closed
+
on:
issues:
types: [closed]
@@ -19,7 +21,7 @@
* If you are happy with the outcome, consider supporting Weblate
by [donating](https://weblate.org/donate/).
- name: Add closed issue comment
uses: peter-evans/create-or-update-comment@v1
- if: "! contains(github.event.issue.labels.*.name, 'question') && !
contains(github.event.issue.labels.*.name, 'wontfix') && !
contains(github.event.issue.labels.*.name, 'duplicate') && !
contains(github.event.issue.labels.*.name, 'undecided')"
+ if: "! contains(github.event.issue.labels.*.name, 'invalid') && !
contains(github.event.issue.labels.*.name, 'question') && !
contains(github.event.issue.labels.*.name, 'wontfix') && !
contains(github.event.issue.labels.*.name, 'duplicate') && !
contains(github.event.issue.labels.*.name, 'undecided') &&
github.event.issue.labels.*.name != ''"
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.github/workflows/labels.yml
new/translation-finder-2.0/.github/workflows/labels.yml
--- old/translation-finder-1.8/.github/workflows/labels.yml 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/.github/workflows/labels.yml 2020-04-14
13:18:52.000000000 +0200
@@ -1,3 +1,5 @@
+name: Issue labeled
+
on:
issues:
types: [labeled]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.github/workflows/lint.yml
new/translation-finder-2.0/.github/workflows/lint.yml
--- old/translation-finder-1.8/.github/workflows/lint.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/translation-finder-2.0/.github/workflows/lint.yml 2020-04-14
13:18:52.000000000 +0200
@@ -0,0 +1,49 @@
+name: Lint
+
+on: [push, pull_request]
+
+jobs:
+ flake8:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/cache@v1
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements*.txt')
}}
+ - name: Setup Python
+ uses: actions/setup-python@v1
+ with:
+ python-version: 3.8
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip wheel
+ pip install -r requirements-test.txt
+ - name: Run flake8
+ run: |
+ echo "::add-matcher::.github/matchers/flake8.json"
+ pre-commit run flake8 --all
+ echo "::remove-matcher owner=flake8::"
+
+ pre-commit:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/cache@v1
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements*.txt')
}}
+ - name: Setup Python
+ uses: actions/setup-python@v1
+ with:
+ python-version: 3.8
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip wheel
+ pip install -r requirements-test.txt
+ - name: pre-commit
+ run: pre-commit run --all
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.github/workflows/setup.yml
new/translation-finder-2.0/.github/workflows/setup.yml
--- old/translation-finder-1.8/.github/workflows/setup.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/translation-finder-2.0/.github/workflows/setup.yml 2020-04-14
13:18:52.000000000 +0200
@@ -0,0 +1,33 @@
+name: Distribution
+
+on: [push, pull_request]
+
+jobs:
+ setup:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/cache@v1
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-setup-${{
hashFiles('**/requirements*.txt') }}
+ - name: Setup Python
+ uses: actions/setup-python@v1
+ with:
+ python-version: 3.8
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip wheel
+ pip install -r requirements-test.txt
+ - name: build
+ run: python ./setup.py sdist bdist_wheel
+ - name: twine
+ run: twine check dist/*
+ - name: Publish package
+ if: github.event_name == 'push' && startsWith(github.event.ref,
'refs/tags')
+ uses: pypa/gh-action-pypi-publish@master
+ with:
+ user: __token__
+ password: ${{ secrets.pypi_password }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.github/workflows/test.yml
new/translation-finder-2.0/.github/workflows/test.yml
--- old/translation-finder-1.8/.github/workflows/test.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/translation-finder-2.0/.github/workflows/test.yml 2020-04-14
13:18:52.000000000 +0200
@@ -0,0 +1,61 @@
+name: Test
+
+on: [push, pull_request]
+
+jobs:
+ test:
+
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ python-version: [3.5, 3.6, 3.7, 3.8]
+ exclude:
+ - os: windows-latest
+ python-version: 3.5
+ - os: windows-latest
+ python-version: 3.6
+ - os: windows-latest
+ python-version: 3.7
+ - os: macos-latest
+ python-version: 3.5
+ - os: macos-latest
+ python-version: 3.6
+ - os: macos-latest
+ python-version: 3.7
+ name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Cache pip
+ uses: actions/cache@v1
+ 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@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install pip dependencies
+ run: |
+ python -m pip install --upgrade pip wheel
+ pip install -r requirements.txt -r requirements-test.txt
+ - name: Test
+ run: |
+ py.test --cov=translation_finder translation_finder README.rst
+ - name: Coverage
+ run: |
+ coverage xml
+ - uses: codecov/codecov-action@v1
+ with:
+ token: ${{secrets.CODECOV_TOKEN}}
+ flags: unittests
+ name: Python ${{ matrix.python-version }}, ${{ matrix.os }}
+ - name: DeepSource
+ if: matrix.os == 'ubuntu-latest'
+ continue-on-error: true
+ env:
+ DEEPSOURCE_DSN: https://[email protected]
+ run: |
+ curl https://deepsource.io/cli | sh
+ ./bin/deepsource report --analyzer test-coverage --key python
--value-file ./coverage.xml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/.github/workflows/workflow.yml
new/translation-finder-2.0/.github/workflows/workflow.yml
--- old/translation-finder-1.8/.github/workflows/workflow.yml 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/.github/workflows/workflow.yml 1970-01-01
01:00:00.000000000 +0100
@@ -1,38 +0,0 @@
-name: Python package
-
-on: [push, pull_request]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
- strategy:
- max-parallel: 4
- matrix:
- python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
-
- steps:
- - uses: actions/checkout@v2
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip wheel
- pip install -U -r requirements-test.txt -r requirements-ci.txt
- - name: Lint with flake8
- run: |
- flake8
- - name: Test with pytest
- run: |
- py.test --cov=translation_finder translation_finder README.rst
- coverage xml
- - uses: codecov/codecov-action@v1
- with:
- token: ${{secrets.CODECOV_TOKEN}}
- name: Python ${{ matrix.python-version }}
- - name: Check sdist
- run: |
- python ./setup.py sdist
- twine check dist/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.pep8speaks.yml
new/translation-finder-2.0/.pep8speaks.yml
--- old/translation-finder-1.8/.pep8speaks.yml 2020-03-05 22:46:47.000000000
+0100
+++ new/translation-finder-2.0/.pep8speaks.yml 1970-01-01 01:00:00.000000000
+0100
@@ -1,3 +0,0 @@
-scanner:
- diff_only: False
- linter: flake8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/.pre-commit-config.yaml
new/translation-finder-2.0/.pre-commit-config.yaml
--- old/translation-finder-1.8/.pre-commit-config.yaml 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/.pre-commit-config.yaml 2020-04-14
13:18:52.000000000 +0200
@@ -1,6 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
+- repo: https://github.com/pre-commit/mirrors-isort
+ rev: v4.3.21
+ hooks:
+ - id: isort
+- repo: https://github.com/ambv/black
+ rev: 19.10b0
+ hooks:
+ - id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
@@ -13,11 +21,10 @@
- id: check-merge-conflict
- id: check-json
- id: fix-encoding-pragma
+ args: [--remove]
- id: sort-simple-yaml
-- repo: https://github.com/pre-commit/mirrors-isort
- rev: v4.3.21
- hooks:
- - id: isort
+ - id: mixed-line-ending
+ args: [--fix=lf]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
@@ -41,8 +48,4 @@
- flake8-self
- flake8-string-format
- pep8-naming
-- repo: https://github.com/ambv/black
- rev: 19.10b0
- hooks:
- - id: black
-exclude: '^.*\.(properties)$'
+exclude:
'^.*\.(properties)|translation_finder/test_data/app/src/res/main/values-it/strings.xml|translation_finder/test_data/app/src/res/main/values/strings.xml|translation_finder/test_data/json/bom-en.json|translation_finder/test_data/yaml/en/corrupt.yml$'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/CHANGES.rst
new/translation-finder-2.0/CHANGES.rst
--- old/translation-finder-1.8/CHANGES.rst 2020-03-05 22:46:47.000000000
+0100
+++ new/translation-finder-2.0/CHANGES.rst 2020-04-14 13:18:52.000000000
+0200
@@ -1,6 +1,14 @@
Changelog
=========
+2.0
+---
+
+* Released on 14th April 2020.
+* Dropped support for Python 2.
+* Improved i18next detection.
+* Improved detection of monolingual templates.
+
1.8
---
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/README.rst
new/translation-finder-2.0/README.rst
--- old/translation-finder-1.8/README.rst 2020-03-05 22:46:47.000000000
+0100
+++ new/translation-finder-2.0/README.rst 2020-04-14 13:18:52.000000000
+0200
@@ -1,21 +1,34 @@
-translation-finder
-==================
+.. image:: https://s.weblate.org/cdn/Logo-Darktext-borders.png
+ :alt: Weblate
+ :target: https://weblate.org/
+ :height: 80px
+
+**Weblate is a copylefted libre software web-based continuous localization
system,
+used by over 1150 libre projects and companies in more than 115 countries.**
A translation file finder for `Weblate`_, translation tool with tight version
control integration.
-.. image::
https://travis-ci.com/WeblateOrg/translation-finder.svg?branch=master
- :target: https://travis-ci.com/WeblateOrg/translation-finder
- :alt: Build Status
-
-.. image::
https://codecov.io/github/WeblateOrg/translation-finder/coverage.svg?branch=master
- :target:
https://codecov.io/github/WeblateOrg/translation-finder?branch=master
- :alt: Code coverage
+.. image:: https://img.shields.io/badge/website-weblate.org-blue.svg
+ :alt: Website
+ :target: https://weblate.org/
+
+.. image:: https://hosted.weblate.org/widgets/weblate/-/svg-badge.svg
+ :alt: Translation status
+ :target: https://hosted.weblate.org/engage/weblate/?utm_source=widget
+
+.. image:: https://bestpractices.coreinfrastructure.org/projects/552/badge
+ :alt: CII Best Practices
+ :target: https://bestpractices.coreinfrastructure.org/projects/552
.. image:: https://img.shields.io/pypi/v/translation-finder.svg
:target: https://pypi.org/project/translation-finder/
:alt: PyPI package
+.. image:: https://readthedocs.org/projects/weblate/badge/
+ :alt: Documentation
+ :target: https://docs.weblate.org/
+
This library is used by `Weblate`_ to discover translation files in a cloned
repository. It can operate on both file listings and actual filesystem.
Filesystem access is needed for more accurate detection in some cases
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/requirements-ci.txt
new/translation-finder-2.0/requirements-ci.txt
--- old/translation-finder-1.8/requirements-ci.txt 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/requirements-ci.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-flake8
-flake8-black; python_version >= '3.6'
-flake8-breakpoint; python_version >= '3.6'
-flake8-builtins
-flake8-comprehensions; python_version >= '3.4'
-flake8-eradicate; python_version >= '3.6'
-flake8-isort
-flake8-logging-format
-flake8-mutable
-flake8-print
-flake8-return; python_version >= '3.6'
-flake8-self; python_version >= '3.4'
-pep8-naming
-twine
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/requirements-test.txt
new/translation-finder-2.0/requirements-test.txt
--- old/translation-finder-1.8/requirements-test.txt 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/requirements-test.txt 2020-04-14
13:18:52.000000000 +0200
@@ -1,6 +1,5 @@
-r requirements.txt
-codacy-coverage
-codecov
pre-commit
pytest
pytest-cov
+twine
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/requirements.txt
new/translation-finder-2.0/requirements.txt
--- old/translation-finder-1.8/requirements.txt 2020-03-05 22:46:47.000000000
+0100
+++ new/translation-finder-2.0/requirements.txt 2020-04-14 13:18:52.000000000
+0200
@@ -1,4 +1,2 @@
chardet
-pathlib2; python_version < '3.4'
ruamel.yaml
-six
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/scripts/generate-language-data
new/translation-finder-2.0/scripts/generate-language-data
--- old/translation-finder-1.8/scripts/generate-language-data 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/scripts/generate-language-data 2020-04-14
13:18:52.000000000 +0200
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -34,8 +33,7 @@
+ r'[() ,.^`"\'\\/_<>!?;:|{}*^@%#&~=+\r\n✓—‑…\[\]0-9-])+'
)
-HEADER = '''# -*- coding: utf-8 -*-
-#
+HEADER = '''#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
# This file is part of Weblate translation-finder
@@ -64,8 +62,6 @@
https://github.com/WeblateOrg/language-data
"""
-from __future__ import unicode_literals
-
'''
WRAPPER = TextWrapper(width=79, initial_indent=" " * 4, subsequent_indent=" "
* 4)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/setup.py
new/translation-finder-2.0/setup.py
--- old/translation-finder-1.8/setup.py 2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/setup.py 2020-04-14 13:18:52.000000000 +0200
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -20,10 +19,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Setup file for easy installation."""
-from __future__ import unicode_literals
import os
-import sys
from setuptools import find_packages, setup
@@ -32,15 +29,14 @@
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme:
LONG_DESCRIPTION = readme.read()
-REQUIRES = [
- line.split(";")[0]
- for line in open("requirements.txt").read().splitlines()
- if "python_version" not in line or sys.version_info < (3, 4)
-]
-REQUIRES_TEST = open("requirements-test.txt").read().splitlines()[1:]
+with open("requirements.txt") as handle:
+ REQUIRES = handle.read().splitlines()
+with open("requirements-test.txt") as handle:
+ REQUIRES_TEST = handle.read().splitlines()[1:]
setup(
name="translation-finder",
+ python_requires=">=3.5",
version=VERSION,
author="Michal Čihař",
author_email="[email protected]",
@@ -66,9 +62,7 @@
"License :: OSI Approved :: GNU General Public License v3 or later
(GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python",
- "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/__init__.py
new/translation-finder-2.0/translation_finder/__init__.py
--- old/translation-finder-1.8/translation_finder/__init__.py 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/__init__.py 2020-04-14
13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -19,11 +18,10 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Translation finder, a module to locate translatable files in a
filesystem."""
-from __future__ import absolute_import, unicode_literals
from .api import discover
from .discovery.result import DiscoveryResult
from .finder import Finder
__all__ = ("Finder", "discover", "DiscoveryResult")
-__version__ = "1.8"
+__version__ = "2.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/translation_finder/api.py
new/translation-finder-2.0/translation_finder/api.py
--- old/translation-finder-1.8/translation_finder/api.py 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/api.py 2020-04-14
13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -19,7 +18,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Highlevel API for translation-finder."""
-from __future__ import absolute_import, print_function, unicode_literals
import sys
from argparse import ArgumentParser
@@ -91,11 +89,14 @@
"https://github.com/WeblateOrg/translation-finder"
),
)
+ parser.add_argument("--source-language", help="Source language code",
default="en")
parser.add_argument("directory", help="Directory where to perform
discovery")
params = parser.parse_args(args)
- for pos, match in enumerate(discover(params.directory)):
+ for pos, match in enumerate(
+ discover(params.directory, source_language=params.source_language)
+ ):
origin = " ({})".format(match.meta["origin"]) if match.meta["origin"]
else ""
print("== Match {}{} ==".format(pos + 1, origin), file=stdout)
for key, value in sorted(match.items()):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/countries.py
new/translation-finder-2.0/translation_finder/countries.py
--- old/translation-finder-1.8/translation_finder/countries.py 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/countries.py 2020-04-14
13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -28,8 +27,6 @@
https://github.com/WeblateOrg/language-data
"""
-from __future__ import unicode_literals
-
# Known country codes
COUNTRIES = {
"abw",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/discovery/base.py
new/translation-finder-2.0/translation_finder/discovery/base.py
--- old/translation-finder-1.8/translation_finder/discovery/base.py
2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/discovery/base.py
2020-04-14 13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -19,7 +18,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Base discovery code."""
-from __future__ import absolute_import, unicode_literals
import re
from itertools import chain
@@ -34,6 +32,33 @@
LOCALES = {"latn", "cyrl", "hant", "hans"}
+EXTENSION_MAP = (
+ (".po", "po"),
+ ("strings.xml", "aresource"),
+ (".ini", "joomla"),
+ (".csv", "csv"),
+ (".json", "json-nested"),
+ (".dtd", "dtd"),
+ (".php", "php"),
+ (".xlf", "xliff"),
+ (".xliff", "xliff"),
+ (".ts", "ts"),
+ (".resx", "resx"),
+ (".resw", "resx"),
+ (".xlsx", "xlsx"),
+ (".yml", "yaml"),
+ (".yaml", "yaml"),
+ (".properties", "properties"),
+ (".strings", "strings"),
+)
+
+TEMPLATE_REPLACEMENTS = (
+ ("/*/", "/"),
+ ("-*", ""),
+ (".*", ""),
+ ("*", ""),
+)
+
class BaseDiscovery(object):
"""Abstract base class for discovery."""
@@ -67,6 +92,13 @@
return False
+ def detect_format(self, filemask):
+ filemask = filemask.lower()
+ for end, result in EXTENSION_MAP:
+ if filemask.endswith(end):
+ return result
+ return ""
+
def get_wildcard(self, part):
"""Generate language wilcard for a path part.
@@ -104,7 +136,8 @@
path = result["filemask"]
basename = path.rsplit("/", 1)[-1].rsplit(".", 1)[0]
if "*" in basename:
- basename = basename.replace(".*", "").replace("-*",
"").replace("*", "")
+ for match, replacement in TEMPLATE_REPLACEMENTS:
+ basename = basename.replace(match, replacement)
new_name = self.new_base_mask.replace("*", basename).lower()
while "/" in path:
@@ -121,13 +154,16 @@
return self.finder.has_file(name)
def get_language_aliases(self, language):
- """Language code aliases"""
+ """Language code aliases."""
return [language]
def possible_templates(self, language, mask):
- """Language code aliases"""
+ """Yield possible template filenames."""
for alias in self.get_language_aliases(language):
yield mask.replace("*", alias)
+ for match, replacement in TEMPLATE_REPLACEMENTS:
+ if match in mask:
+ yield mask.replace(match, replacement)
def fill_in_template(self, result, source_language=None):
if "template" not in result:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/discovery/files.py
new/translation-finder-2.0/translation_finder/discovery/files.py
--- old/translation-finder-1.8/translation_finder/discovery/files.py
2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/discovery/files.py
2020-04-14 13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -19,12 +18,10 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Individual discovery rules for translation formats."""
-from __future__ import absolute_import, unicode_literals
import json
from itertools import chain
-import six
from ruamel.yaml import YAML
from ruamel.yaml.error import YAMLError, YAMLFutureWarning
@@ -39,7 +36,7 @@
new_base_mask = "*.pot"
def discover(self):
- for result in super(GettextDiscovery, self).discover():
+ for result in super().discover():
if "template" not in result:
yield result
continue
@@ -51,7 +48,7 @@
yield mono
def fill_in_new_base(self, result):
- super(GettextDiscovery, self).fill_in_new_base(result)
+ super().fill_in_new_base(result)
if "new_base" not in result:
pot_names = [
result["filemask"].replace("po/*/", "pot/") + "t",
@@ -143,7 +140,7 @@
def possible_templates(self, language, mask):
yield mask.replace("_*", "")
- for result in super(JavaDiscovery, self).possible_templates(language,
mask):
+ for result in super().possible_templates(language, mask):
yield result
@@ -156,7 +153,7 @@
def possible_templates(self, language, mask):
yield mask.replace(".*", "")
- for result in super(RESXDiscovery, self).possible_templates(language,
mask):
+ for result in super().possible_templates(language, mask):
yield result
def get_masks(self):
@@ -170,7 +167,7 @@
continue
mask[-1] = "{0}.*.{1}".format(base, ext)
yield {"filemask": "/".join(mask)}
- for match in super(RESXDiscovery, self).get_masks():
+ for match in super().get_masks():
yield match
@@ -196,7 +193,7 @@
return self.finder.has_dir(name)
def get_language_aliases(self, language):
- """Language code aliases"""
+ """Language code aliases."""
if language == "en":
return ["en", "en-US", "en-GB", "en-AU"]
return [language]
@@ -208,6 +205,29 @@
file_format = "json-nested"
mask = "*.json"
+ def detect_dict(self, data, level=0):
+ all_strings = True
+ i18next = False
+ for key, value in data.items():
+ if (
+ level == 0
+ and isinstance(value, dict)
+ and "message" in value
+ and "description" in value
+ ):
+ return False, False, True
+ if not isinstance(key, str):
+ all_strings = False
+ break
+ if not isinstance(value, str):
+ all_strings = False
+ if isinstance(value, dict):
+ i18next |= self.detect_dict(value, level + 1)[1]
+ elif key.endswith("_plural") or "{{" in value:
+ i18next = True
+
+ return all_strings, i18next, False
+
def adjust_format(self, result):
if "template" not in result:
return
@@ -224,29 +244,15 @@
return
if not isinstance(data, dict):
return
- all_strings = True
- i18next = False
- for key, value in data.items():
- if (
- isinstance(value, dict)
- and "message" in value
- and "description" in value
- ):
- result["file_format"] = "webextension"
- return
- if not isinstance(key, six.string_types) or not isinstance(
- value, six.string_types
- ):
- all_strings = False
- break
- elif key.endswith("_plural") or "{{" in value:
- i18next = True
- if all_strings:
- if i18next:
- result["file_format"] = "i18next"
- else:
- result["file_format"] = "json"
+ all_strings, i18next, webext = self.detect_dict(data)
+
+ if webext:
+ result["file_format"] = "webextension"
+ elif i18next:
+ result["file_format"] = "i18next"
+ elif all_strings:
+ result["file_format"] = "json"
class FluentDiscovery(BaseDiscovery):
@@ -256,7 +262,7 @@
mask = "*.ftl"
def get_language_aliases(self, language):
- """Language code aliases"""
+ """Language code aliases."""
if language == "en":
return ["en", "en-US"]
return [language]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/discovery/result.py
new/translation-finder-2.0/translation_finder/discovery/result.py
--- old/translation-finder-1.8/translation_finder/discovery/result.py
2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/discovery/result.py
2020-04-14 13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -19,12 +18,11 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Discovery result class."""
-from __future__ import unicode_literals
class DiscoveryResult(dict):
def __init__(self, *args, **kwargs):
- super(DiscoveryResult, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self.meta = {}
@property
@@ -40,7 +38,7 @@
return self._sort_key < other._sort_key # noqa:SF01,SLF001
def __eq__(self, other):
- return super(DiscoveryResult, self).__eq__(other) and (
+ return super().__eq__(other) and (
self.meta == other.meta if isinstance(other, DiscoveryResult) else
True
)
@@ -51,6 +49,6 @@
return "{!r} [meta:{!r}]".format(self.match, self.meta)
def copy(self):
- result = DiscoveryResult(super(DiscoveryResult, self).copy())
+ result = DiscoveryResult(super().copy())
result.meta = self.meta.copy()
return result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/discovery/transifex.py
new/translation-finder-2.0/translation_finder/discovery/transifex.py
--- old/translation-finder-1.8/translation_finder/discovery/transifex.py
2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/discovery/transifex.py
2020-04-14 13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -19,9 +18,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Transifex configuration discovery."""
-from __future__ import absolute_import, unicode_literals
-from six.moves.configparser import RawConfigParser
+from configparser import RawConfigParser
from .base import BaseDiscovery
@@ -52,26 +50,6 @@
"YML": "ruby-yaml",
}
- extension_map = (
- (".po", "po"),
- ("strings.xml", "aresource"),
- (".ini", "joomla"),
- (".csv", "csv"),
- (".json", "json-nested"),
- (".dtd", "dtd"),
- (".php", "php"),
- (".xlf", "xliff"),
- (".xliff", "xliff"),
- (".ts", "ts"),
- (".resx", "resx"),
- (".resw", "resx"),
- (".xlsx", "xlsx"),
- (".yml", "yaml"),
- (".yaml", "yaml"),
- (".properties", "properties"),
- (".strings", "strings"),
- )
-
def extract_format(self, transifex):
transifex = transifex.upper()
try:
@@ -79,13 +57,6 @@
except KeyError:
return ""
- def detect_format(self, filemask):
- filemask = filemask.lower()
- for end, result in self.extension_map:
- if filemask.endswith(end):
- return result
- return ""
-
def extract_section(self, config, section):
if section == "main" or not config.has_option(section, "file_filter"):
return None
@@ -117,7 +88,7 @@
for path in self.finder.filter_files("config", ".tx"):
config = RawConfigParser()
with self.finder.open(path) as handle:
- config.readfp(handle)
+ config.read_file(handle)
for section in config.sections():
result = self.extract_section(config, section)
if result:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/translation_finder/finder.py
new/translation-finder-2.0/translation_finder/finder.py
--- old/translation-finder-1.8/translation_finder/finder.py 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/finder.py 2020-04-14
13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -19,7 +18,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Filesystem finder for translations."""
-from __future__ import absolute_import, unicode_literals
from fnmatch import fnmatch
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/languages.py
new/translation-finder-2.0/translation_finder/languages.py
--- old/translation-finder-1.8/translation_finder/languages.py 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/languages.py 2020-04-14
13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -28,8 +27,6 @@
https://github.com/WeblateOrg/language-data
"""
-from __future__ import unicode_literals
-
# Known language codes
LANGUAGES = {
"aa",
@@ -92,6 +89,7 @@
"bez",
"bg",
"bh",
+ "bho",
"bih",
"bis",
"bm",
@@ -133,6 +131,8 @@
"chu",
"chv",
"ckb",
+ "ckb_iq",
+ "ckb_ir",
"cmn",
"cn",
"co",
@@ -154,6 +154,7 @@
"de_at",
"de_ch",
"de_fo",
+ "de_lu",
"deu",
"div",
"dk",
@@ -186,6 +187,7 @@
"es",
"es_419",
"es_ar",
+ "es_bo",
"es_cl",
"es_do",
"es_ec",
@@ -194,11 +196,13 @@
"es_pe",
"es_pr",
"es_us",
+ "es_ve",
"est",
"et",
"eu",
"eus",
"ewe",
+ "ext",
"fa",
"fa_af",
"fao",
@@ -215,6 +219,7 @@
"fr_be",
"fr_ca",
"fr_ch",
+ "fr_lu",
"fra",
"fre",
"french",
@@ -239,6 +244,7 @@
"grn",
"gsw",
"gu",
+ "gu_in",
"guj",
"gun",
"guw",
@@ -249,6 +255,7 @@
"haw",
"hbs",
"he",
+ "he_il",
"heb",
"her",
"hi",
@@ -279,6 +286,7 @@
"ik",
"iku",
"ile",
+ "in_id",
"ina",
"ind",
"indonesian",
@@ -289,6 +297,7 @@
"ita",
"iu",
"iw",
+ "iw_il",
"ja",
"ja_ks",
"jam",
@@ -342,6 +351,7 @@
"kv",
"kw",
"ky",
+ "kz",
"la",
"lag",
"lao",
@@ -438,6 +448,7 @@
"ori",
"orm",
"os",
+ "osa",
"oss",
"otk",
"pa",
@@ -508,6 +519,7 @@
"sin",
"sk",
"sl",
+ "sl_sl",
"slk",
"slo",
"slv",
@@ -638,6 +650,7 @@
"zh_hans_sg",
"zh_hant",
"zh_hant_hk",
+ "zh_hant_tw",
"zh_hk",
"zh_sg",
"zh_tw",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/test_api.py
new/translation-finder-2.0/translation_finder/test_api.py
--- old/translation-finder-1.8/translation_finder/test_api.py 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/test_api.py 2020-04-14
13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -18,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
-from __future__ import absolute_import, unicode_literals
import os.path
from io import StringIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/test_discovery.py
new/translation-finder-2.0/translation_finder/test_discovery.py
--- old/translation-finder-1.8/translation_finder/test_discovery.py
2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/test_discovery.py
2020-04-14 13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -18,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
-from __future__ import absolute_import, unicode_literals
import os.path
from unittest import TestCase
@@ -282,9 +280,18 @@
def test_new_base(self):
discovery = GettextDiscovery(self.get_finder(["foo.fr.po", "foo.po"]))
+ print(list(discovery.discover()))
self.assert_discovery(
discovery.discover(),
- [{"filemask": "foo.*.po", "file_format": "po", "new_base":
"foo.po"}],
+ [
+ {"filemask": "foo.*.po", "new_base": "foo.po", "file_format":
"po"},
+ {
+ "filemask": "foo.*.po",
+ "template": "foo.po",
+ "new_base": "foo.po",
+ "file_format": "po-mono",
+ },
+ ],
)
@@ -561,6 +568,8 @@
"Source/JavaScriptCore/inspector/protocol/Canvas.json",
"Source/JavaScriptCore/inspector/protocol/Target.json",
"Source/JavaScriptCore/inspector/protocol/Console.json",
+ "data/cs/strings.json",
+ "data/strings.json",
]
)
)
@@ -582,6 +591,11 @@
"file_format": "json-nested",
"template": "tr/recordings-en.json",
},
+ {
+ "filemask": "data/*/strings.json",
+ "file_format": "json-nested",
+ "template": "data/strings.json",
+ },
],
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/test_finder.py
new/translation-finder-2.0/translation_finder/test_finder.py
--- old/translation-finder-1.8/translation_finder/test_finder.py
2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/test_finder.py
2020-04-14 13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -18,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
-from __future__ import absolute_import, unicode_literals
import os.path
from unittest import TestCase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/translation-finder-1.8/translation_finder/test_results.py
new/translation-finder-2.0/translation_finder/test_results.py
--- old/translation-finder-1.8/translation_finder/test_results.py
2020-03-05 22:46:47.000000000 +0100
+++ new/translation-finder-2.0/translation_finder/test_results.py
2020-04-14 13:18:52.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#
@@ -18,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
-from __future__ import absolute_import
from pickle import dumps, loads
from unittest import TestCase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/translation-finder-1.8/weblate-discovery
new/translation-finder-2.0/weblate-discovery
--- old/translation-finder-1.8/weblate-discovery 2020-03-05
22:46:47.000000000 +0100
+++ new/translation-finder-2.0/weblate-discovery 2020-04-14
13:18:52.000000000 +0200
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2020 Michal Čihař <[email protected]>
#