commit python-setuptools-gettext for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-setuptools-gettext for openSUSE:Factory checked in at 2024-01-03 12:24:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-setuptools-gettext (Old) and /work/SRC/openSUSE:Factory/.python-setuptools-gettext.new.28375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-setuptools-gettext" Wed Jan 3 12:24:38 2024 rev:3 rq:1136273 version:0.1.8 Changes: -------- --- /work/SRC/openSUSE:Factory/python-setuptools-gettext/python-setuptools-gettext.changes 2023-06-12 15:26:21.691020082 +0200 +++ /work/SRC/openSUSE:Factory/.python-setuptools-gettext.new.28375/python-setuptools-gettext.changes 2024-01-03 12:24:47.307039793 +0100 @@ -1,0 +2,8 @@ +Fri Dec 29 10:28:24 UTC 2023 - Dirk Müller <dmueller@suse.com> + +- update to 0.1.8: + * **Full Changelog**: https://github.com/breezy- + team/setuptools-gettext/compare/v0.1.1...v0.1.7 + * Delay adding entry points to finalize_distribution_options + +------------------------------------------------------------------- Old: ---- setuptools-gettext-0.1.1.tar.gz New: ---- setuptools-gettext-0.1.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-setuptools-gettext.spec ++++++ --- /var/tmp/diff_new_pack.JIfXQX/_old 2024-01-03 12:24:48.371078671 +0100 +++ /var/tmp/diff_new_pack.JIfXQX/_new 2024-01-03 12:24:48.375078817 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-setuptools-gettext # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,22 +18,19 @@ %{?sle15_python_module_pythons} Name: python-setuptools-gettext -Version: 0.1.1 +Version: 0.1.8 Release: 0 Summary: Setuptools gettext extension plugin License: GPL-2.0-or-later URL: https://github.com/breezy-team/setuptools-gettext Source: https://files.pythonhosted.org/packages/source/s/setuptools-gettext/setuptools-gettext-%{version}.tar.gz BuildRequires: %{python_module pip} -BuildRequires: %{python_module setuptools >= 46.1} +BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-setuptools >= 46.1 BuildArch: noarch -# SECTION test requirements -BuildRequires: %{python_module setuptools >= 46.1} -# /SECTION %python_subpackages %description @@ -56,5 +53,5 @@ %doc README.md %license COPYING %{python_sitelib}/setuptools_gettext -%{python_sitelib}/setuptools_gettext-%{version}*-info +%{python_sitelib}/setuptools_gettext-%{version}.dist-info ++++++ setuptools-gettext-0.1.1.tar.gz -> setuptools-gettext-0.1.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/.github/workflows/disperse.yml new/setuptools-gettext-0.1.8/.github/workflows/disperse.yml --- old/setuptools-gettext-0.1.1/.github/workflows/disperse.yml 2022-10-20 23:41:36.000000000 +0200 +++ new/setuptools-gettext-0.1.8/.github/workflows/disperse.yml 2023-12-05 00:26:00.000000000 +0100 @@ -11,14 +11,4 @@ steps: - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - - name: Install dependencies - run: | - sudo apt install protobuf-compiler - - name: Install disperse - run: | - pip install git+https://github.com/jelmer/disperse - - name: Validate disperse.conf - run: | - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python disperse validate . + - uses: jelmer/action-disperse-validate@v1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/.github/workflows/pythontest.yml new/setuptools-gettext-0.1.8/.github/workflows/pythontest.yml --- old/setuptools-gettext-0.1.1/.github/workflows/pythontest.yml 2022-10-20 23:41:36.000000000 +0200 +++ new/setuptools-gettext-0.1.8/.github/workflows/pythontest.yml 2023-12-05 00:26:00.000000000 +0100 @@ -13,18 +13,13 @@ matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: - ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11.0-rc - 3.11", pypy3] - exclude: - - os: macos-latest - python-version: pypy3 - - os: windows-latest - python-version: pypy3 + ["3.7", "3.8", "3.9", "3.10", "3.11"] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -36,8 +31,8 @@ if: "matrix.os == 'ubuntu-latest'" - name: Style checks run: | - pip install -U flake8 - python -m flake8 + pip install -U ruff + python -m ruff check . - name: Typing checks run: | pip install -U mypy types-setuptools diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/.gitignore new/setuptools-gettext-0.1.8/.gitignore --- old/setuptools-gettext-0.1.1/.gitignore 2022-10-20 23:41:36.000000000 +0200 +++ new/setuptools-gettext-0.1.8/.gitignore 2023-12-05 00:26:00.000000000 +0100 @@ -1,3 +1,5 @@ dist build setuptools_gettext.egg-info +*~ +__pycache__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/MANIFEST.in new/setuptools-gettext-0.1.8/MANIFEST.in --- old/setuptools-gettext-0.1.1/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/MANIFEST.in 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1 @@ +graft example/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/PKG-INFO new/setuptools-gettext-0.1.8/PKG-INFO --- old/setuptools-gettext-0.1.1/PKG-INFO 2022-10-20 23:41:44.439694400 +0200 +++ new/setuptools-gettext-0.1.8/PKG-INFO 2023-12-05 00:26:04.905951300 +0100 @@ -1,14 +1,13 @@ Metadata-Version: 2.1 Name: setuptools-gettext -Version: 0.1.1 +Version: 0.1.8 Summary: Setuptools gettext extension plugin -Home-page: https://github.com/breezy-team/setuptools-gettext -Maintainer: Breezy Developers -Maintainer-email: breezy-core@googlegroups.com -License: GPLv2 or later +Maintainer-email: Breezy Developers <breezy-core@googlegroups.com> +Project-URL: Homepage, https://github.com/breezy-team/setuptools-gettext +Project-URL: repository, https://github.com/breezy-team/setuptools-gettext.git Keywords: distutils,setuptools,gettext Classifier: Topic :: Software Development :: Version Control -Classifier: License :: OSI Approved :: Apache Software License +Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 @@ -18,10 +17,34 @@ Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows -Requires-Python: >=3.6 +Requires-Python: >=3.7 Description-Content-Type: text/markdown License-File: COPYING # setuptools plugin for gettext Compile .po files into .mo files. + +This plugin adds `build_mo`, `clean_mo` and `install_mo` subcommands for +setup.py as well as hooking those into standard commands. + +## Usage + +By default, setuptools_gettext compiles and installs mo files when there is a +`po` directory present that contains ``.po`` files. + +The .mo files are installed adjacent to your package as package data in a subdirectory called ``locale``. + +You can override these settings in ``pyproject.toml``: + +```toml +[build-system] +requires = ["setuptools", "setuptools-gettext"] +... + +[tool.setuptools-gettext] +# directory in which the .po files can be found +source_dir = "po" +# directory in which the generated .mo files are placed when building +build_dir = "breezy/locale" +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/README.md new/setuptools-gettext-0.1.8/README.md --- old/setuptools-gettext-0.1.1/README.md 2022-10-20 23:41:36.000000000 +0200 +++ new/setuptools-gettext-0.1.8/README.md 2023-12-05 00:26:00.000000000 +0100 @@ -1,3 +1,27 @@ # setuptools plugin for gettext Compile .po files into .mo files. + +This plugin adds `build_mo`, `clean_mo` and `install_mo` subcommands for +setup.py as well as hooking those into standard commands. + +## Usage + +By default, setuptools_gettext compiles and installs mo files when there is a +`po` directory present that contains ``.po`` files. + +The .mo files are installed adjacent to your package as package data in a subdirectory called ``locale``. + +You can override these settings in ``pyproject.toml``: + +```toml +[build-system] +requires = ["setuptools", "setuptools-gettext"] +... + +[tool.setuptools-gettext] +# directory in which the .po files can be found +source_dir = "po" +# directory in which the generated .mo files are placed when building +build_dir = "breezy/locale" +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/disperse.conf new/setuptools-gettext-0.1.8/disperse.conf --- old/setuptools-gettext-0.1.1/disperse.conf 2022-10-20 23:41:36.000000000 +0200 +++ new/setuptools-gettext-0.1.8/disperse.conf 2023-12-05 00:26:00.000000000 +0100 @@ -1,7 +1,7 @@ # See https://github.com/jelmer/disperse timeout_days: 5 tag_name: "v$VERSION" -verify_command: "flake8" +verify_command: "ruff check ." update_version { path: "setuptools_gettext/__init__.py" match: "^__version__ = \((.*)\)$" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/.gitignore new/setuptools-gettext-0.1.8/example/.gitignore --- old/setuptools-gettext-0.1.1/example/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/.gitignore 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,2 @@ +hallowereld.egg-info +hallowereld/locale diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/README.md new/setuptools-gettext-0.1.8/example/README.md --- old/setuptools-gettext-0.1.1/example/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/README.md 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,11 @@ +This directory contains an example project that uses ``setuptools_gettext``. + +Note that while it uses the standard Python ``gettext`` module to access translations, +``setuptools_gettext`` will also happily work with other gettext-compatible +packages. + +The pot file can be updated by running ``./setup.py update-pot`` in the current +directory. + +A new translation file can be created by +running ``msginit -l $LANG -o po/$LANG.po po/hallowereld.pot``. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/hallowereld/__init__.py new/setuptools-gettext-0.1.8/example/hallowereld/__init__.py --- old/setuptools-gettext-0.1.1/example/hallowereld/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/hallowereld/__init__.py 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,33 @@ +"""A simple example of a Python package with translations.""" + +# Use the "_" shorthand for gettext +from gettext import gettext as _ + + +def hallo() -> str: + return _("Hello World!") + + +def load_translations(): + import gettext + import os + + if os.path.exists('setup.py'): + # We are running from source, so we need to install the translations + locale_dir = os.path.join(os.path.dirname(__file__), "locale") + else: + # Otherwise, we assume the translations are installed in the relevant + # system directory that shares our prefix + + # Note that we can't just use sys.prefix, since while Python might be + # installed in /usr, our package (and thus the translations) might be + # in /usr/local + locale_dir = os.path.join( + os.path.dirname(__file__), + "..", "..", "..", "..", "share", "locale") + gettext.bindtextdomain("hallowereld", localedir=locale_dir) + print("Loading translations from", locale_dir) + + # Set the default domain, so we can use gettext (or _()) instead of + # dgettext + gettext.textdomain("hallowereld") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/hallowereld/__main__.py new/setuptools-gettext-0.1.8/example/hallowereld/__main__.py --- old/setuptools-gettext-0.1.1/example/hallowereld/__main__.py 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/hallowereld/__main__.py 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,5 @@ +from . import hallo, load_translations + +load_translations() + +print(hallo()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/po/hallowereld.pot new/setuptools-gettext-0.1.8/example/po/hallowereld.pot --- old/setuptools-gettext-0.1.1/example/po/hallowereld.pot 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/po/hallowereld.pot 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the hallowereld package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: hallowereld\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-12-04 14:57+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: hallowereld/__init__.py:6 +msgid "Hello World!" +msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/po/nl.po new/setuptools-gettext-0.1.8/example/po/nl.po --- old/setuptools-gettext-0.1.1/example/po/nl.po 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/po/nl.po 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,22 @@ +# Dutch translations for hallowereld package. +# Copyright (C) 2023 THE hallowereld'S COPYRIGHT HOLDER +# This file is distributed under the same license as the hallowereld package. +# Jelmer Vernooij <jelmer@jelmer.uk>, 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: hallowereld\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-12-04 14:57+0000\n" +"PO-Revision-Date: 2023-12-04 14:58+0000\n" +"Last-Translator: Jelmer Vernooij <jelmer@jelmer.uk>\n" +"Language-Team: Dutch <vertaling@vrijschrift.org>\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: hallowereld/__init__.py:6 +msgid "Hello World!" +msgstr "Hallo Wereld!" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/pyproject.toml new/setuptools-gettext-0.1.8/example/pyproject.toml --- old/setuptools-gettext-0.1.1/example/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/pyproject.toml 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,15 @@ +[build-system] +requires = ["setuptools", "setuptools-gettext"] + +[project] +name = "hallowereld" +version = "0.1.0" + +[tool.setuptools] +packages = ["hallowereld"] + +[tool.setuptools-gettext] +source_dir = "po" +# Set the build directory, to make it easier to find the compiled catalogs +# in the source tree. +build_dir = "hallowereld/locale" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/example/setup.py new/setuptools-gettext-0.1.8/example/setup.py --- old/setuptools-gettext-0.1.1/example/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/example/setup.py 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,5 @@ +#!/usr/bin/python3 + +from setuptools import setup + +setup() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/pyproject.toml new/setuptools-gettext-0.1.8/pyproject.toml --- old/setuptools-gettext-0.1.1/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/setuptools-gettext-0.1.8/pyproject.toml 2023-12-05 00:26:00.000000000 +0100 @@ -0,0 +1,77 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "setuptools-gettext" +maintainers = [{name = "Breezy Developers", email = "breezy-core@googlegroups.com"}] +description = "Setuptools gettext extension plugin" +keywords = ["distutils", "setuptools", "gettext"] +classifiers = [ + "Topic :: Software Development :: Version Control", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Operating System :: POSIX", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", +] +requires-python = ">=3.7" +dependencies = ["setuptools>=60.8", 'tomli>=1.2.1; python_version<"3.11"'] +dynamic = ["version"] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +Homepage = "https://github.com/breezy-team/setuptools-gettext" +repository = "https://github.com/breezy-team/setuptools-gettext.git" + +[project.entry-points."distutils.commands"] +build_mo = "setuptools_gettext:build_mo" +clean_mo = "setuptools_gettext:clean_mo" +install_mo = "setuptools_gettext:install_mo" +update_pot = "setuptools_gettext:update_pot" + +[project.entry-points."setuptools.finalize_distribution_options"] +setuptools_gettext = "setuptools_gettext:pyprojecttoml_config" + +[tool.setuptools] +packages = ["setuptools_gettext"] +zip-safe = true +include-package-data = false + +[tool.setuptools.dynamic] +version = {attr = "setuptools_gettext.__version__"} + +[tool.mypy] +ignore_missing_imports = true + +[tool.ruff] +select = [ + "ANN", + "D", + "E", + "F", + "I", + "UP", +] +target-version = "py37" +line-length = 79 +ignore = [ + "ANN001", + "ANN101", + "ANN201", + "D100", + "D101", + "D102", + "D103", +] + +[tool.ruff.pydocstyle] +convention = "google" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/setup.cfg new/setuptools-gettext-0.1.8/setup.cfg --- old/setuptools-gettext-0.1.1/setup.cfg 2022-10-20 23:41:44.439694400 +0200 +++ new/setuptools-gettext-0.1.8/setup.cfg 2023-12-05 00:26:04.905951300 +0100 @@ -1,44 +1,3 @@ -[metadata] -name = setuptools-gettext -version = attr:setuptools_gettext.__version__ -maintainer = Breezy Developers -maintainer_email = breezy-core@googlegroups.com -license = GPLv2 or later -description = Setuptools gettext extension plugin -keywords = distutils, setuptools, gettext -url = https://github.com/breezy-team/setuptools-gettext -long_description = file:README.md -long_description_content_type = text/markdown -classifiers = - Topic :: Software Development :: Version Control - License :: OSI Approved :: Apache Software License - Intended Audience :: Developers - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Operating System :: POSIX - Operating System :: MacOS :: MacOS X - Operating System :: Microsoft :: Windows - -[options] -packages = setuptools_gettext -zip_safe = True -install_requires = setuptools>=46.1 -setup_requires = setuptools>=46.1 -python_requires = >=3.6 - -[options.entry_points] -distutils.commands = - build_mo = setuptools_gettext:build_mo - -[mypy] -ignore_missing_imports = True - -[flake8] -exclude = build - [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/setup.py new/setuptools-gettext-0.1.8/setup.py --- old/setuptools-gettext-0.1.1/setup.py 2022-10-20 23:41:36.000000000 +0200 +++ new/setuptools-gettext-0.1.8/setup.py 2023-12-05 00:26:00.000000000 +0100 @@ -1,4 +1,5 @@ #!/usr/bin/python3 from setuptools import setup + setup() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/setuptools_gettext/__init__.py new/setuptools-gettext-0.1.8/setuptools_gettext/__init__.py --- old/setuptools-gettext-0.1.1/setuptools_gettext/__init__.py 2022-10-20 23:41:38.000000000 +0200 +++ new/setuptools-gettext-0.1.8/setuptools_gettext/__init__.py 2023-12-05 00:26:02.000000000 +0100 @@ -1,7 +1,6 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2007, 2009, 2011 Canonical Ltd. -# Copyright (C) 2022 Breezy Developers +# Copyright (C) 2022-2023 Jelmer Vernooij <jelmer@jelmer.uk> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,21 +18,38 @@ # This code is from bzr-explorer and modified for bzr. -"""build_mo command for setup.py""" +"""build_mo command for setup.py.""" -from distutils import log -from distutils.core import Command -from distutils.dep_util import newer -from distutils.spawn import find_executable +import logging import os import re +import sys +from typing import List, Optional, Tuple +from setuptools import Command +from setuptools.dist import Distribution -__version__ = (0, 1, 1) +__version__ = (0, 1, 8) +DEFAULT_SOURCE_DIR = 'po' +DEFAULT_BUILD_DIR = 'locale' + + +def lang_from_dir(source_dir: os.PathLike) -> List[str]: + re_po = re.compile(r'^([a-zA-Z_]+)\.po$') + lang = [] + for i in os.listdir(source_dir): + mo = re_po.match(i) + if mo: + lang.append(mo.group(1)) + return lang + + +def parse_lang(lang: str) -> List[str]: + return [i.strip() for i in lang.split(',') if i.strip()] class build_mo(Command): - """Subcommand of build command: build_mo""" + """Subcommand of build command: build_mo.""" description = 'compile po files to mo files' @@ -43,7 +59,6 @@ # - help string. user_options = [('build-dir=', 'd', 'Directory to build locale files'), ('output-base=', 'o', 'mo-files base name'), - ('source-dir=', None, 'Directory with sources po files'), ('force', 'f', 'Force creation of mo files'), ('lang=', None, 'Comma-separated list of languages ' 'to process'), @@ -54,45 +69,50 @@ def initialize_options(self): self.build_dir = None self.output_base = None - self.source_dir = None self.force = None self.lang = None + self.outfiles = [] def finalize_options(self): self.set_undefined_options('build', ('force', 'force')) self.prj_name = self.distribution.get_name() - if self.build_dir is None: - self.build_dir = 'breezy/locale' if not self.output_base: self.output_base = self.prj_name or 'messages' - if self.source_dir is None: - self.source_dir = 'po' + self.source_dir = self.distribution.gettext_source_dir + if self.build_dir is None: + self.build_dir = ( + getattr(self.distribution, 'gettext_build_dir', None) + or DEFAULT_BUILD_DIR) if self.lang is None: - re_po = re.compile(r'^([a-zA-Z_]+)\.po$') - self.lang = [] - for i in os.listdir(self.source_dir): - mo = re_po.match(i) - if mo: - self.lang.append(mo.group(1)) + self.lang = lang_from_dir(self.source_dir) else: - self.lang = [i.strip() for i in self.lang.split(',') if i.strip()] + self.lang = parse_lang(self.lang) + + def get_inputs(self): + inputs = [] + for lang in self.lang: + po = os.path.join(self.source_dir, lang + '.po') + if not os.path.isfile(po): + po = os.path.join(self.source_dir, lang + '.po') + inputs.append(po) + return inputs def run(self): - """Run msgfmt for each language""" + """Run msgfmt for each language.""" if not self.lang: return if find_executable('msgfmt') is None: - log.warn("GNU gettext msgfmt utility not found!") - log.warn("Skip compiling po files.") + logging.warn("GNU gettext msgfmt utility not found!") + logging.warn("Skip compiling po files.") return if 'en' in self.lang: if find_executable('msginit') is None: - log.warn("GNU gettext msginit utility not found!") - log.warn("Skip creating English PO file.") + logging.warn("GNU gettext msginit utility not found!") + logging.warn("Skip creating English PO file.") else: - log.info('Creating English PO file...') + logging.info('Creating English PO file...') pot = (self.prj_name or 'messages') + '.pot' en_po = 'en.po' self.spawn(['msginit', @@ -107,12 +127,232 @@ basename += '.mo' for lang in self.lang: - po = os.path.join('po', lang + '.po') + po = os.path.join(self.source_dir, lang + '.po') if not os.path.isfile(po): - po = os.path.join('po', lang + '.po') + po = os.path.join(self.source_dir, lang + '.po') dir_ = os.path.join(self.build_dir, lang, 'LC_MESSAGES') self.mkpath(dir_) mo = os.path.join(dir_, basename) if self.force or newer(po, mo): - log.info('Compile: %s -> %s' % (po, mo)) + logging.info(f'Compile: {po} -> {mo}') self.spawn(['msgfmt', '-o', mo, po]) + self.outfiles.append(mo) + + def get_outputs(self): + return self.outfiles + + +class clean_mo(Command): + description = 'clean .mo files' + + user_options = [('build-dir=', 'd', 'Directory to build locale files')] + + def initialize_options(self): + self.build_dir = None + + def finalize_options(self): + if self.build_dir is None: + self.build_dir = ( + getattr(self.distribution, 'gettext_build_dir', None) + or DEFAULT_BUILD_DIR) + + def run(self): + if not os.path.isdir(self.build_dir): + return + for root, dirs, files in os.walk(self.build_dir): + for file_ in files: + if file_.endswith('.mo'): + os.unlink(os.path.join(root, file_)) + + +class install_mo(Command): + + description: str = "install .mo files" + + user_options = [ + ( + 'install-dir=', + 'd', + "base directory for installing data files " + "(default: installation base dir)", + ), + ('root=', None, + "install everything relative to this alternate root directory"), + ('force', 'f', "force installation (overwrite existing files)"), + ] + + boolean_options: List[str] = ['force'] + build_dir: Optional[str] + install_dir: Optional[str] + root: Optional[str] + + def initialize_options(self) -> None: + self.install_dir = None + self.outfiles: List[str] = [] + self.root = None + self.force = 0 + self.build_dir = None + + def finalize_options(self) -> None: + self.set_undefined_options( + 'install', + ('install_data', 'install_dir'), + ('root', 'root'), + ('force', 'force'), + ) + if self.build_dir is None: + self.build_dir = ( + self.distribution.gettext_build_dir) # type: ignore + + def run(self) -> None: + assert self.install_dir is not None + assert self.build_dir is not None + self.mkpath(self.install_dir) + import glob + for filepath in glob.glob(self.build_dir + "/*/LC_MESSAGES/*.mo"): + langfile = filepath[len(self.build_dir.rstrip('/')+'/'):] + targetpath = os.path.join( + self.install_dir, + os.path.dirname(os.path.join("share/locale", langfile))) + if self.root is not None: + targetpath = change_root(self.root, targetpath) + self.mkpath(targetpath) + (out, _) = self.copy_file(filepath, targetpath) + self.outfiles.append(out) + + def get_inputs(self): + import glob + return glob.glob(self.build_dir + "/*/LC_MESSAGES/*.mo") + + def get_outputs(self): + return self.outfiles + + +class update_pot(Command): + + description: str = "update the .pot file" + + user_options: List[Tuple[str, str, str]] = [] + + def initialize_options(self) -> None: + pass + + def finalize_options(self) -> None: + pass + + def run(self) -> None: + # TODO(jelmer): Support pygettext3 as well + xgettext = find_executable('xgettext') + if xgettext is None: + logging.error("GNU gettext xgettext utility not found!") + return + args = [xgettext] + args.extend([ + "--package-name", self.distribution.get_name(), + "--from-code", "UTF-8", + "--sort-by-file", + "--add-comments=i18n:", + "-d", self.distribution.get_name(), + "-p", self.distribution.gettext_source_dir, # type: ignore + "-o", f"{self.distribution.get_name()}.pot", + ]) + + input_files = [] + for root, _dirs, files in os.walk('.'): + for file_ in files: + if file_.endswith('.py'): + input_files.append(os.path.join(root, file_)) + args.extend(input_files) + + pot_path = os.path.join( + self.distribution.gettext_source_dir, self.distribution.get_name()) # type: ignore + if os.path.exists(pot_path): + args.append("--join") + if self.distribution.get_contact(): + args += ["--msgid-bugs-address", self.distribution.get_contact()] + + self.spawn(args) + + +def has_gettext(_c) -> bool: + return os.path.isdir(DEFAULT_SOURCE_DIR) + + +def pyprojecttoml_config(dist: Distribution) -> None: + build = dist.get_command_class("build") + build.sub_commands.append(('build_mo', has_gettext)) + clean = dist.get_command_class("clean") + clean.sub_commands.append(('clean_mo', has_gettext)) + install = dist.get_command_class("install") + install.sub_commands.append(('install_mo', has_gettext)) + + if sys.version_info[:2] >= (3, 11): + from tomllib import load as toml_load + else: + from tomli import load as toml_load + try: + with open("pyproject.toml", "rb") as f: + cfg = toml_load(f).get("tool", {}).get("setuptools-gettext") + except FileNotFoundError: + load_pyproject_config(dist, {}) + else: + if cfg: + load_pyproject_config(dist, cfg) + else: + load_pyproject_config(dist, {}) + + +def load_pyproject_config(dist: Distribution, cfg) -> None: + dist.gettext_source_dir = ( # type: ignore + cfg.get("source_dir") or DEFAULT_SOURCE_DIR) + dist.gettext_build_dir = ( # type: ignore + cfg.get("build_dir") or DEFAULT_BUILD_DIR) + + +def find_executable(executable): + _, ext = os.path.splitext(executable) + if sys.platform == 'win32' and ext != '.exe': + executable = executable + '.exe' + + if os.path.isfile(executable): + return executable + + path = os.environ.get('PATH', os.defpath) + + # PATH='' doesn't match, whereas PATH=':' looks in the current directory + if not path: + return None + + paths = path.split(os.pathsep) + for p in paths: + f = os.path.join(p, executable) + if os.path.isfile(f): + return f + return None + + +def newer(source, target) -> bool: + if not os.path.exists(target): + return True + + from stat import ST_MTIME + + mtime1 = os.stat(source)[ST_MTIME] + mtime2 = os.stat(target)[ST_MTIME] + + return mtime1 > mtime2 + + +def change_root(new_root, pathname): + if os.name == 'posix': + if not os.path.isabs(pathname): + return os.path.join(new_root, pathname) + else: + return os.path.join(new_root, pathname[1:]) + elif os.name == 'nt': + (drive, path) = os.path.splitdrive(pathname) + if path[0] == '\\': + path = path[1:] + return os.path.join(new_root, path) + else: + raise AssertionError("Unsupported OS: %s" % os.name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/PKG-INFO new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/PKG-INFO --- old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/PKG-INFO 2022-10-20 23:41:44.000000000 +0200 +++ new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/PKG-INFO 2023-12-05 00:26:04.000000000 +0100 @@ -1,14 +1,13 @@ Metadata-Version: 2.1 Name: setuptools-gettext -Version: 0.1.1 +Version: 0.1.8 Summary: Setuptools gettext extension plugin -Home-page: https://github.com/breezy-team/setuptools-gettext -Maintainer: Breezy Developers -Maintainer-email: breezy-core@googlegroups.com -License: GPLv2 or later +Maintainer-email: Breezy Developers <breezy-core@googlegroups.com> +Project-URL: Homepage, https://github.com/breezy-team/setuptools-gettext +Project-URL: repository, https://github.com/breezy-team/setuptools-gettext.git Keywords: distutils,setuptools,gettext Classifier: Topic :: Software Development :: Version Control -Classifier: License :: OSI Approved :: Apache Software License +Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 @@ -18,10 +17,34 @@ Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows -Requires-Python: >=3.6 +Requires-Python: >=3.7 Description-Content-Type: text/markdown License-File: COPYING # setuptools plugin for gettext Compile .po files into .mo files. + +This plugin adds `build_mo`, `clean_mo` and `install_mo` subcommands for +setup.py as well as hooking those into standard commands. + +## Usage + +By default, setuptools_gettext compiles and installs mo files when there is a +`po` directory present that contains ``.po`` files. + +The .mo files are installed adjacent to your package as package data in a subdirectory called ``locale``. + +You can override these settings in ``pyproject.toml``: + +```toml +[build-system] +requires = ["setuptools", "setuptools-gettext"] +... + +[tool.setuptools-gettext] +# directory in which the .po files can be found +source_dir = "po" +# directory in which the generated .mo files are placed when building +build_dir = "breezy/locale" +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/SOURCES.txt new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/SOURCES.txt --- old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/SOURCES.txt 2022-10-20 23:41:44.000000000 +0200 +++ new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/SOURCES.txt 2023-12-05 00:26:04.000000000 +0100 @@ -1,11 +1,20 @@ .gitignore COPYING +MANIFEST.in README.md disperse.conf -setup.cfg +pyproject.toml setup.py .github/workflows/disperse.yml .github/workflows/pythontest.yml +example/.gitignore +example/README.md +example/pyproject.toml +example/setup.py +example/hallowereld/__init__.py +example/hallowereld/__main__.py +example/po/hallowereld.pot +example/po/nl.po setuptools_gettext/__init__.py setuptools_gettext.egg-info/PKG-INFO setuptools_gettext.egg-info/SOURCES.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/entry_points.txt new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/entry_points.txt --- old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/entry_points.txt 2022-10-20 23:41:44.000000000 +0200 +++ new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/entry_points.txt 2023-12-05 00:26:04.000000000 +0100 @@ -1,2 +1,8 @@ [distutils.commands] build_mo = setuptools_gettext:build_mo +clean_mo = setuptools_gettext:clean_mo +install_mo = setuptools_gettext:install_mo +update_pot = setuptools_gettext:update_pot + +[setuptools.finalize_distribution_options] +setuptools_gettext = setuptools_gettext:pyprojecttoml_config diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/requires.txt new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/requires.txt --- old/setuptools-gettext-0.1.1/setuptools_gettext.egg-info/requires.txt 2022-10-20 23:41:44.000000000 +0200 +++ new/setuptools-gettext-0.1.8/setuptools_gettext.egg-info/requires.txt 2023-12-05 00:26:04.000000000 +0100 @@ -1 +1,4 @@ -setuptools>=46.1 +setuptools>=60.8 + +[:python_version < "3.11"] +tomli>=1.2.1
participants (1)
-
Source-Sync