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 2026-11-13 18:35:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-setuptools-gettext (Old)
 and      /work/SRC/openSUSE:Factory/.python-setuptools-gettext.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-setuptools-gettext"

Fri Nov 13 18:35:09 2026 rev:8 rq:1397251 version:0.1.20

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-setuptools-gettext/python-setuptools-gettext.changes
      2026-05-20 15:26:11.054250788 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-setuptools-gettext.new.1251/python-setuptools-gettext.changes
    2026-11-13 18:39:04.588810679 +0100
@@ -1,0 +2,13 @@
+Thu Nov 12 22:25:44 UTC 2026 - Alexander Bergmann <[email protected]>
+
+- update to 0.1.20:
+  * Drop support for Python 3.9; add Python 3.15.
+  * Modernize type annotations (builtin generics, PEP 604 unions).
+  * Dependency updates for development tooling.
+- update to 0.1.19:
+  * Add support for package-based installation (#194)
+  * Require setuptools>=69.0 for setuptools.modified (#217)
+  * Use bool for install_mo.force to match Command base type (#215)
+  * Various dev-dependency bumps (ruff, mypy)
+
+-------------------------------------------------------------------

Old:
----
  setuptools_gettext-0.1.18.tar.gz

New:
----
  setuptools_gettext-0.1.20.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-setuptools-gettext.spec ++++++
--- /var/tmp/diff_new_pack.9NV0ak/_old  2026-11-13 18:39:07.213921745 +0100
+++ /var/tmp/diff_new_pack.9NV0ak/_new  2026-11-13 18:39:07.217921915 +0100
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-setuptools-gettext
-Version:        0.1.18
+Version:        0.1.20
 Release:        0
 Summary:        Setuptools gettext extension plugin
 License:        GPL-2.0-or-later

++++++ setuptools_gettext-0.1.18.tar.gz -> setuptools_gettext-0.1.20.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_gettext-0.1.18/PKG-INFO 
new/setuptools_gettext-0.1.20/PKG-INFO
--- old/setuptools_gettext-0.1.18/PKG-INFO      2026-05-19 14:44:18.065828300 
+0200
+++ new/setuptools_gettext-0.1.20/PKG-INFO      2026-10-31 16:36:10.081469800 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.4
 Name: setuptools-gettext
-Version: 0.1.18
+Version: 0.1.20
 Summary: Setuptools gettext extension plugin
 Maintainer-email: Breezy Developers <[email protected]>
 Project-URL: Homepage, https://github.com/breezy-team/setuptools-gettext
@@ -9,23 +9,23 @@
 Classifier: Topic :: Software Development :: Version Control
 Classifier: License :: OSI Approved :: GNU General Public License v2 or later 
(GPLv2+)
 Classifier: Intended Audience :: Developers
+Classifier: Programming Language :: Python :: 3.15
 Classifier: Programming Language :: Python :: 3.14
 Classifier: Programming Language :: Python :: 3.13
 Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: 3.11
 Classifier: Programming Language :: Python :: 3.10
-Classifier: Programming Language :: Python :: 3.9
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: MacOS :: MacOS X
 Classifier: Operating System :: Microsoft :: Windows
-Requires-Python: >=3.9
+Requires-Python: >=3.10
 Description-Content-Type: text/markdown
 License-File: COPYING
-Requires-Dist: setuptools>=61.0
+Requires-Dist: setuptools>=69.0
 Requires-Dist: tomli>=1.2.1; python_version < "3.11"
 Provides-Extra: dev
-Requires-Dist: ruff==0.15.13; extra == "dev"
-Requires-Dist: mypy==1.19.1; extra == "dev"
+Requires-Dist: ruff==0.17.2; extra == "dev"
+Requires-Dist: mypy==2.4.0; extra == "dev"
 Provides-Extra: translate-toolkit
 Requires-Dist: translate-toolkit>=3.14.0; extra == "translate-toolkit"
 Dynamic: license-file
@@ -45,7 +45,10 @@
 absent and a top-level ``locale`` directory contains standard gettext catalogs,
 that directory is used automatically.
 
-The .mo files are installed adjacent to your package as package data in a 
subdirectory called ``locale``.
+By default, the ``install_mo`` command installs compiled catalogs under
+``share/locale`` to preserve compatibility with earlier releases. Django apps
+and other packages that load catalogs from package data can opt into package
+installation with ``install_layout = "package"``.
 
 You can override these settings in ``pyproject.toml``:
 
@@ -61,6 +64,8 @@
 build_dir = "breezy/locale"
 # compiler to use: "auto", "msgfmt", or "translate-toolkit"
 compiler = "auto"
+# install compiled catalogs below share/locale or inside a package
+install_layout = "share"
 ```
 
 For standard gettext layouts, point both directories at the locale tree:
@@ -77,6 +82,20 @@
 ``<build_dir>/de/LC_MESSAGES/django.mo`` by default. Passing
 ``--output-base`` overrides the output name for both layouts.
 
+For Django apps, keep the ``locale`` directory inside the app package and use
+the package install layout:
+
+```toml
+[tool.setuptools-gettext]
+source_dir = "myapp/locale"
+build_dir = "myapp/locale"
+install_layout = "package"
+```
+
+With this configuration, ``myapp/locale/de/LC_MESSAGES/django.po`` compiles to
+``myapp/locale/de/LC_MESSAGES/django.mo`` and is included as package data when
+building the package.
+
 ## Compilation tool
 
 By default, either ``msgfmt`` or the `translate-toolkit` package is used to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_gettext-0.1.18/README.md 
new/setuptools_gettext-0.1.20/README.md
--- old/setuptools_gettext-0.1.18/README.md     2026-05-19 14:34:09.000000000 
+0200
+++ new/setuptools_gettext-0.1.20/README.md     2026-10-31 16:36:02.635387000 
+0100
@@ -13,7 +13,10 @@
 absent and a top-level ``locale`` directory contains standard gettext catalogs,
 that directory is used automatically.
 
-The .mo files are installed adjacent to your package as package data in a 
subdirectory called ``locale``.
+By default, the ``install_mo`` command installs compiled catalogs under
+``share/locale`` to preserve compatibility with earlier releases. Django apps
+and other packages that load catalogs from package data can opt into package
+installation with ``install_layout = "package"``.
 
 You can override these settings in ``pyproject.toml``:
 
@@ -29,6 +32,8 @@
 build_dir = "breezy/locale"
 # compiler to use: "auto", "msgfmt", or "translate-toolkit"
 compiler = "auto"
+# install compiled catalogs below share/locale or inside a package
+install_layout = "share"
 ```
 
 For standard gettext layouts, point both directories at the locale tree:
@@ -45,6 +50,20 @@
 ``<build_dir>/de/LC_MESSAGES/django.mo`` by default. Passing
 ``--output-base`` overrides the output name for both layouts.
 
+For Django apps, keep the ``locale`` directory inside the app package and use
+the package install layout:
+
+```toml
+[tool.setuptools-gettext]
+source_dir = "myapp/locale"
+build_dir = "myapp/locale"
+install_layout = "package"
+```
+
+With this configuration, ``myapp/locale/de/LC_MESSAGES/django.po`` compiles to
+``myapp/locale/de/LC_MESSAGES/django.mo`` and is included as package data when
+building the package.
+
 ## Compilation tool
 
 By default, either ``msgfmt`` or the `translate-toolkit` package is used to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_gettext-0.1.18/example/pyproject.toml 
new/setuptools_gettext-0.1.20/example/pyproject.toml
--- old/setuptools_gettext-0.1.18/example/pyproject.toml        2026-05-19 
14:34:09.000000000 +0200
+++ new/setuptools_gettext-0.1.20/example/pyproject.toml        2026-10-31 
16:36:02.636341300 +0100
@@ -14,3 +14,4 @@
 # Set the build directory, to make it easier to find the compiled catalogs
 # in the source tree.
 build_dir = "hallowereld/locale"
+install_layout = "package"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_gettext-0.1.18/pyproject.toml 
new/setuptools_gettext-0.1.20/pyproject.toml
--- old/setuptools_gettext-0.1.18/pyproject.toml        2026-05-19 
14:34:09.000000000 +0200
+++ new/setuptools_gettext-0.1.20/pyproject.toml        2026-10-31 
16:36:02.636341300 +0100
@@ -1,5 +1,5 @@
 [build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools>=69.0"]
 build-backend = "setuptools.build_meta"
 
 [project]
@@ -11,19 +11,19 @@
     "Topic :: Software Development :: Version Control",
     "License :: OSI Approved :: GNU General Public License v2 or later 
(GPLv2+)",
     "Intended Audience :: Developers",
+    "Programming Language :: Python :: 3.15",
     "Programming Language :: Python :: 3.14",
     "Programming Language :: Python :: 3.13",
     "Programming Language :: Python :: 3.12",
     "Programming Language :: Python :: 3.11",
     "Programming Language :: Python :: 3.10",
-    "Programming Language :: Python :: 3.9",
     "Operating System :: POSIX",
     "Operating System :: MacOS :: MacOS X",
     "Operating System :: Microsoft :: Windows",
 ]
-requires-python = ">=3.9"
+requires-python = ">=3.10"
 dependencies = [
-    "setuptools>=61.0",
+    "setuptools>=69.0",
     'tomli>=1.2.1; python_version<"3.11"',
 ]
 dynamic = ["version"]
@@ -50,8 +50,8 @@
 
 [project.optional-dependencies]
 dev = [
-    "ruff==0.15.13",
-    "mypy==1.19.1"
+    "ruff==0.17.2",
+    "mypy==2.4.0"
 ]
 translate-toolkit = [
     "translate-toolkit>=3.14.0"
@@ -69,7 +69,7 @@
 ignore_missing_imports = true
 
 [tool.ruff]
-target-version = "py38"
+target-version = "py310"
 line-length = 79
 
 [tool.ruff.lint]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_gettext-0.1.18/setuptools_gettext/__init__.py 
new/setuptools_gettext-0.1.20/setuptools_gettext/__init__.py
--- old/setuptools_gettext-0.1.18/setuptools_gettext/__init__.py        
2026-05-19 14:34:09.000000000 +0200
+++ new/setuptools_gettext-0.1.20/setuptools_gettext/__init__.py        
2026-10-31 16:36:02.636341300 +0100
@@ -23,7 +23,6 @@
 import logging
 import os
 import sys
-from typing import Dict, List, Optional, Tuple
 
 from setuptools import Command
 from setuptools.dist import Distribution
@@ -38,8 +37,15 @@
     mo_basename,
     parse_lang,
 )
+from .install_layout import (
+    DEFAULT_INSTALL_LAYOUT,
+    add_package_data_for_build_dir,
+    normalize_install_layout,
+    package_install_dir,
+    package_locale_info,
+)
 
-__version__ = (0, 1, 18)
+__version__ = (0, 1, 20)
 DEFAULT_SOURCE_DIR = "po"
 DEFAULT_BUILD_DIR = "locale"
 DEFAULT_LANGUAGE = "en"
@@ -82,6 +88,25 @@
     return source_dir
 
 
+def _insert_sub_command(command_class, name, predicate, before=None) -> None:
+    sub_commands = [
+        sub_command
+        for sub_command in command_class.sub_commands
+        if sub_command[0] != name
+    ]
+    entry = (name, predicate)
+    if before is not None:
+        for index, sub_command in enumerate(sub_commands):
+            if sub_command[0] == before:
+                sub_commands.insert(index, entry)
+                break
+        else:
+            sub_commands.append(entry)
+    else:
+        sub_commands.append(entry)
+    command_class.sub_commands = sub_commands
+
+
 # Imported from distutils.util in Python 3.11:
 def convert_path(pathname):
     """Return 'pathname' as a name that will work on the native filesystem.
@@ -153,6 +178,15 @@
                 getattr(self.distribution, "gettext_build_dir", None)
                 or DEFAULT_BUILD_DIR
             )
+        if (
+            getattr(
+                self.distribution,
+                "gettext_install_layout",
+                DEFAULT_INSTALL_LAYOUT,
+            )
+            == "package"
+        ):
+            add_package_data_for_build_dir(self.distribution, self.build_dir)
         if self.msgfmt is None and self.translate_toolkit is None:
             compiler = getattr(
                 self.distribution, "gettext_compiler", DEFAULT_COMPILER
@@ -187,7 +221,7 @@
         )
 
     def _check_duplicate_outputs(self) -> None:
-        targets: Dict[str, str] = {}
+        targets: dict[str, str] = {}
         for catalog in self.catalogs:
             mo = self._mo_path(catalog)
             if mo in targets:
@@ -298,7 +332,7 @@
                     os.unlink(os.path.join(root, file_))
 
 
-def gather_built_files(build_dir) -> List[str]:
+def gather_built_files(build_dir) -> list[str]:
     import glob
 
     return glob.glob(build_dir + "/*/LC_MESSAGES/*.mo")
@@ -324,22 +358,36 @@
 
     boolean_options = ["force"]
 
-    build_dir: Optional[str]
+    build_dir: str | None
 
     def initialize_options(self) -> None:
-        self.data_files: List[str] = []
+        self.data_files: list[str] = []
         self.build_dir = None
         self.install_dir = None
-        self.outfiles: List[str] = []
+        self.install_layout = DEFAULT_INSTALL_LAYOUT
+        self.outfiles: list[str] = []
+        self.package_locale: tuple[str, str, str] | None = None
         self.root = None
-        self.force = 0
+        self.force = False
 
     def finalize_options(self) -> None:
         if self.build_dir is None:
-            self.build_dir = self.distribution.gettext_build_dir  # type: 
ignore
+            self.build_dir = self.distribution.gettext_build_dir  # type: 
ignore[attr-defined]
+        self.install_layout = getattr(
+            self.distribution,
+            "gettext_install_layout",
+            DEFAULT_INSTALL_LAYOUT,
+        )
+        if self.install_layout == "package":
+            install_dir_option = "install_lib"
+            self.package_locale = package_locale_info(
+                self.distribution, self.build_dir
+            )
+        else:
+            install_dir_option = "install_data"
         self.set_undefined_options(
             "install",
-            ("install_data", "install_dir"),
+            (install_dir_option, "install_dir"),
             ("root", "root"),
             ("force", "force"),
         )
@@ -349,10 +397,17 @@
         self.mkpath(self.install_dir)
         assert self.build_dir is not None
         for filepath in gather_built_files(self.build_dir):
-            langfile = filepath[len(self.build_dir.rstrip("/") + "/") :]
-            install_dir = os.path.dirname(
-                os.path.join("share/locale", langfile)
-            )
+            langfile = os.path.relpath(filepath, self.build_dir)
+            if self.install_layout == "package":
+                assert self.package_locale is not None
+                package, _package_dir, relative_build_dir = self.package_locale
+                install_dir = package_install_dir(
+                    package, relative_build_dir, langfile
+                )
+            else:
+                install_dir = os.path.dirname(
+                    os.path.join("share/locale", langfile)
+                )
 
             # it's a tuple with path to install to and a list of files
             dir = convert_path(install_dir)
@@ -377,7 +432,7 @@
 class update_pot(Command):
     description: str = "update the .pot file"
 
-    user_options: List[Tuple[str, str, str]] = []  # type: ignore
+    user_options: list[tuple[str, str, str]] = []  # type: ignore
 
     def initialize_options(self) -> None:
         pass
@@ -446,18 +501,20 @@
 
 
 def pyprojecttoml_config(dist: Distribution) -> None:
+    load_pyproject_config(dist, _load_pyproject_toml())
+
     build = dist.get_command_class("build")
-    build.sub_commands.append(("build_mo", has_gettext))
+    _insert_sub_command(build, "build_mo", has_gettext, before="build_py")
     clean = dist.get_command_class("clean")
-    clean.sub_commands.append(("clean_mo", has_gettext))
+    _insert_sub_command(clean, "clean_mo", has_gettext)
     install = dist.get_command_class("install")
-    install.sub_commands.append(("install_mo", has_gettext))
-
-    load_pyproject_config(dist, _load_pyproject_toml())
+    _insert_sub_command(install, "install_mo", has_gettext)
 
 
 def load_pyproject_config(dist: Distribution, cfg) -> None:
-    dist.gettext_source_dir_configured = bool(cfg.get("source_dir"))  # type: 
ignore
+    dist.gettext_source_dir_configured = (  # type: ignore
+        bool(cfg.get("source_dir"))
+    )
     dist.gettext_source_dir = (  # type: ignore
         cfg.get("source_dir") or _detect_default_source_dir()
     )
@@ -470,6 +527,9 @@
     dist.gettext_compiler = _normalize_compiler(  # type: ignore
         cfg.get("compiler", DEFAULT_COMPILER)
     )
+    dist.gettext_install_layout = normalize_install_layout(  # type: ignore
+        cfg.get("install_layout", DEFAULT_INSTALL_LAYOUT)
+    )
 
 
 def _normalize_compiler(compiler) -> str:
@@ -489,7 +549,7 @@
     return compiler
 
 
-def find_source_files(dirname: str = "") -> List[str]:
+def find_source_files(dirname: str = "") -> list[str]:
     """Find .po/.pot source files for inclusion in the sdist.
 
     Registered as a ``setuptools.file_finders`` entry point so that
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_gettext-0.1.18/setuptools_gettext/catalog.py 
new/setuptools_gettext-0.1.20/setuptools_gettext/catalog.py
--- old/setuptools_gettext-0.1.18/setuptools_gettext/catalog.py 2026-05-19 
14:34:09.000000000 +0200
+++ new/setuptools_gettext-0.1.20/setuptools_gettext/catalog.py 2026-10-31 
16:36:02.636738500 +0100
@@ -22,7 +22,6 @@
 import os
 from dataclasses import dataclass
 from glob import glob
-from typing import List, Optional
 
 LC_MESSAGES = "LC_MESSAGES"
 
@@ -35,8 +34,8 @@
     uses_output_base: bool
 
 
-def lang_from_dir(source_dir: os.PathLike) -> List[str]:
-    lang: List[str] = []
+def lang_from_dir(source_dir: os.PathLike) -> list[str]:
+    lang: list[str] = []
     if not os.path.isdir(source_dir):
         return lang
     for i in os.listdir(source_dir):
@@ -45,11 +44,11 @@
     return lang
 
 
-def parse_lang(lang: str) -> List[str]:
+def parse_lang(lang: str) -> list[str]:
     return [i.strip() for i in lang.split(",") if i.strip()]
 
 
-def _flat_catalogs_from_dir(source_dir: os.PathLike) -> List[Catalog]:
+def _flat_catalogs_from_dir(source_dir: os.PathLike) -> list[Catalog]:
     return [
         Catalog(
             lang=lang,
@@ -61,7 +60,7 @@
     ]
 
 
-def _standard_catalogs_from_dir(source_dir: os.PathLike) -> List[Catalog]:
+def _standard_catalogs_from_dir(source_dir: os.PathLike) -> list[Catalog]:
     catalogs = []
     pattern = os.path.join(source_dir, "*", LC_MESSAGES, "*.po")
     for po in glob(pattern):
@@ -79,8 +78,8 @@
 
 
 def discover_catalogs(
-    source_dir: os.PathLike, lang: Optional[List[str]] = None
-) -> List[Catalog]:
+    source_dir: os.PathLike, lang: list[str] | None = None
+) -> list[Catalog]:
     if lang is None:
         catalogs = _flat_catalogs_from_dir(source_dir)
         catalogs.extend(_standard_catalogs_from_dir(source_dir))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_gettext-0.1.18/setuptools_gettext/install_layout.py 
new/setuptools_gettext-0.1.20/setuptools_gettext/install_layout.py
--- old/setuptools_gettext-0.1.18/setuptools_gettext/install_layout.py  
1970-01-01 01:00:00.000000000 +0100
+++ new/setuptools_gettext-0.1.20/setuptools_gettext/install_layout.py  
2026-10-31 16:36:02.636738500 +0100
@@ -0,0 +1,154 @@
+#
+# Copyright (C) 2026 Michal Cihar <[email protected]>
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+
+"""Install layout helpers for compiled gettext catalogs."""
+
+import os
+
+from setuptools.dist import Distribution
+from setuptools.errors import OptionError
+
+from .catalog import LC_MESSAGES
+
+DEFAULT_INSTALL_LAYOUT = "share"
+VALID_INSTALL_LAYOUTS = ("share", "package")
+
+
+def normalize_install_layout(install_layout) -> str:
+    if install_layout is None:
+        return DEFAULT_INSTALL_LAYOUT
+    if not isinstance(install_layout, str):
+        raise ValueError(
+            "Unsupported setuptools-gettext install_layout "
+            f"{install_layout!r}; expected one of: "
+            f"{', '.join(VALID_INSTALL_LAYOUTS)}"
+        )
+    install_layout = install_layout.strip().lower()
+    if install_layout not in VALID_INSTALL_LAYOUTS:
+        raise ValueError(
+            "Unsupported setuptools-gettext install_layout "
+            f"{install_layout!r}; expected one of: "
+            f"{', '.join(VALID_INSTALL_LAYOUTS)}"
+        )
+    return install_layout
+
+
+def package_locale_info(
+    dist: Distribution, build_dir: str
+) -> tuple[str, str, str]:
+    matches = []
+    for package in getattr(dist, "packages", None) or []:
+        package_dir = _get_package_dir(dist, package)
+        if _is_inside_path(build_dir, package_dir):
+            relative = os.path.relpath(
+                os.path.abspath(build_dir), os.path.abspath(package_dir)
+            )
+            matches.append(
+                (
+                    len(os.path.abspath(package_dir)),
+                    package,
+                    package_dir,
+                    "" if relative == os.curdir else relative,
+                )
+            )
+
+    if not matches:
+        raise OptionError(
+            "setuptools-gettext install_layout='package' requires "
+            "build_dir to be inside a configured package"
+        )
+
+    _length, package, package_dir, relative = max(matches)
+    return package, package_dir, relative
+
+
+def add_package_data_for_build_dir(dist: Distribution, build_dir: str) -> None:
+    package, _package_dir, relative_build_dir = package_locale_info(
+        dist, build_dir
+    )
+    pattern = _package_data_pattern(relative_build_dir)
+
+    package_data = getattr(dist, "package_data", None) or {}
+    patterns = list(package_data.get(package, []))
+    if pattern not in patterns:
+        patterns.append(pattern)
+    package_data[package] = patterns
+    dist.package_data = package_data
+
+
+def package_install_dir(
+    package: str, relative_build_dir: str, langfile: str
+) -> str:
+    parts = package.split(".")
+    if relative_build_dir:
+        parts.append(relative_build_dir)
+    parts.append(langfile)
+    return os.path.dirname(os.path.join(*parts))
+
+
+def _get_package_dir(dist: Distribution, package: str) -> str:
+    path = package.split(".")
+    package_dir = getattr(dist, "package_dir", None) or {}
+    if not package_dir:
+        result = os.path.join(*path) if path else ""
+    else:
+        tail: list[str] = []
+        while path:
+            package_name = ".".join(path)
+            if package_name in package_dir:
+                tail.insert(0, package_dir[package_name])
+                result = os.path.join(*tail)
+                break
+            tail.insert(0, path[-1])
+            del path[-1]
+        else:
+            default_dir = package_dir.get("")
+            if default_dir is not None:
+                tail.insert(0, default_dir)
+            result = os.path.join(*tail) if tail else ""
+
+    src_root = getattr(dist, "src_root", None)
+    if src_root is not None:
+        return os.path.join(src_root, result)
+    return result
+
+
+def _is_inside_path(path: str, parent: str) -> bool:
+    path = os.path.normcase(os.path.abspath(path))
+    parent = os.path.normcase(os.path.abspath(parent))
+    try:
+        relative = os.path.relpath(path, parent)
+    except ValueError:
+        return False
+    return relative == os.curdir or (
+        relative != os.pardir and not relative.startswith(os.pardir + os.sep)
+    )
+
+
+def _package_data_pattern(relative_build_dir: str) -> str:
+    relative_build_dir = relative_build_dir.replace(os.sep, "/")
+    return "/".join(
+        part
+        for part in (
+            relative_build_dir,
+            "*",
+            LC_MESSAGES,
+            "*.mo",
+        )
+        if part
+    )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_gettext-0.1.18/setuptools_gettext.egg-info/PKG-INFO 
new/setuptools_gettext-0.1.20/setuptools_gettext.egg-info/PKG-INFO
--- old/setuptools_gettext-0.1.18/setuptools_gettext.egg-info/PKG-INFO  
2026-05-19 14:44:18.000000000 +0200
+++ new/setuptools_gettext-0.1.20/setuptools_gettext.egg-info/PKG-INFO  
2026-10-31 16:36:10.064122000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.4
 Name: setuptools-gettext
-Version: 0.1.18
+Version: 0.1.20
 Summary: Setuptools gettext extension plugin
 Maintainer-email: Breezy Developers <[email protected]>
 Project-URL: Homepage, https://github.com/breezy-team/setuptools-gettext
@@ -9,23 +9,23 @@
 Classifier: Topic :: Software Development :: Version Control
 Classifier: License :: OSI Approved :: GNU General Public License v2 or later 
(GPLv2+)
 Classifier: Intended Audience :: Developers
+Classifier: Programming Language :: Python :: 3.15
 Classifier: Programming Language :: Python :: 3.14
 Classifier: Programming Language :: Python :: 3.13
 Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: 3.11
 Classifier: Programming Language :: Python :: 3.10
-Classifier: Programming Language :: Python :: 3.9
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: MacOS :: MacOS X
 Classifier: Operating System :: Microsoft :: Windows
-Requires-Python: >=3.9
+Requires-Python: >=3.10
 Description-Content-Type: text/markdown
 License-File: COPYING
-Requires-Dist: setuptools>=61.0
+Requires-Dist: setuptools>=69.0
 Requires-Dist: tomli>=1.2.1; python_version < "3.11"
 Provides-Extra: dev
-Requires-Dist: ruff==0.15.13; extra == "dev"
-Requires-Dist: mypy==1.19.1; extra == "dev"
+Requires-Dist: ruff==0.17.2; extra == "dev"
+Requires-Dist: mypy==2.4.0; extra == "dev"
 Provides-Extra: translate-toolkit
 Requires-Dist: translate-toolkit>=3.14.0; extra == "translate-toolkit"
 Dynamic: license-file
@@ -45,7 +45,10 @@
 absent and a top-level ``locale`` directory contains standard gettext catalogs,
 that directory is used automatically.
 
-The .mo files are installed adjacent to your package as package data in a 
subdirectory called ``locale``.
+By default, the ``install_mo`` command installs compiled catalogs under
+``share/locale`` to preserve compatibility with earlier releases. Django apps
+and other packages that load catalogs from package data can opt into package
+installation with ``install_layout = "package"``.
 
 You can override these settings in ``pyproject.toml``:
 
@@ -61,6 +64,8 @@
 build_dir = "breezy/locale"
 # compiler to use: "auto", "msgfmt", or "translate-toolkit"
 compiler = "auto"
+# install compiled catalogs below share/locale or inside a package
+install_layout = "share"
 ```
 
 For standard gettext layouts, point both directories at the locale tree:
@@ -77,6 +82,20 @@
 ``<build_dir>/de/LC_MESSAGES/django.mo`` by default. Passing
 ``--output-base`` overrides the output name for both layouts.
 
+For Django apps, keep the ``locale`` directory inside the app package and use
+the package install layout:
+
+```toml
+[tool.setuptools-gettext]
+source_dir = "myapp/locale"
+build_dir = "myapp/locale"
+install_layout = "package"
+```
+
+With this configuration, ``myapp/locale/de/LC_MESSAGES/django.po`` compiles to
+``myapp/locale/de/LC_MESSAGES/django.mo`` and is included as package data when
+building the package.
+
 ## Compilation tool
 
 By default, either ``msgfmt`` or the `translate-toolkit` package is used to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_gettext-0.1.18/setuptools_gettext.egg-info/SOURCES.txt 
new/setuptools_gettext-0.1.20/setuptools_gettext.egg-info/SOURCES.txt
--- old/setuptools_gettext-0.1.18/setuptools_gettext.egg-info/SOURCES.txt       
2026-05-19 14:44:18.000000000 +0200
+++ new/setuptools_gettext-0.1.20/setuptools_gettext.egg-info/SOURCES.txt       
2026-10-31 16:36:10.072359300 +0100
@@ -13,6 +13,7 @@
 example/po/nl.po
 setuptools_gettext/__init__.py
 setuptools_gettext/catalog.py
+setuptools_gettext/install_layout.py
 setuptools_gettext.egg-info/PKG-INFO
 setuptools_gettext.egg-info/SOURCES.txt
 setuptools_gettext.egg-info/dependency_links.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_gettext-0.1.18/setuptools_gettext.egg-info/requires.txt 
new/setuptools_gettext-0.1.20/setuptools_gettext.egg-info/requires.txt
--- old/setuptools_gettext-0.1.18/setuptools_gettext.egg-info/requires.txt      
2026-05-19 14:44:18.000000000 +0200
+++ new/setuptools_gettext-0.1.20/setuptools_gettext.egg-info/requires.txt      
2026-10-31 16:36:10.066382400 +0100
@@ -1,11 +1,11 @@
-setuptools>=61.0
+setuptools>=69.0
 
 [:python_version < "3.11"]
 tomli>=1.2.1
 
 [dev]
-ruff==0.15.13
-mypy==1.19.1
+ruff==0.17.2
+mypy==2.4.0
 
 [translate-toolkit]
 translate-toolkit>=3.14.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setuptools_gettext-0.1.18/tests/test_example.py 
new/setuptools_gettext-0.1.20/tests/test_example.py
--- old/setuptools_gettext-0.1.18/tests/test_example.py 2026-05-19 
14:34:09.000000000 +0200
+++ new/setuptools_gettext-0.1.20/tests/test_example.py 2026-10-31 
16:36:02.636738500 +0100
@@ -61,6 +61,7 @@
     load_pyproject_config(dist, {})
 
     assert getattr(dist, "gettext_compiler") == "auto"
+    assert getattr(dist, "gettext_install_layout") == "share"
 
 
 @pytest.mark.parametrize("compiler", ["auto", "msgfmt", "translate-toolkit"])
@@ -79,6 +80,22 @@
         load_pyproject_config(dist, {"compiler": "invalid"})
 
 
[email protected]("install_layout", ["share", "package"])
+def test_load_pyproject_config_install_layout(install_layout):
+    dist = Distribution()
+
+    load_pyproject_config(dist, {"install_layout": install_layout})
+
+    assert getattr(dist, "gettext_install_layout") == install_layout
+
+
+def test_load_pyproject_config_rejects_invalid_install_layout():
+    dist = Distribution()
+
+    with pytest.raises(ValueError, match="Unsupported setuptools-gettext"):
+        load_pyproject_config(dist, {"install_layout": "invalid"})
+
+
 def test_build_mo_uses_msgfmt_compiler_from_config():
     with TemporaryDirectory() as td:
         source_dir = os.path.join(td, "po")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/setuptools_gettext-0.1.18/tests/test_setuptools_gettext.py 
new/setuptools_gettext-0.1.20/tests/test_setuptools_gettext.py
--- old/setuptools_gettext-0.1.18/tests/test_setuptools_gettext.py      
2026-05-19 14:34:09.000000000 +0200
+++ new/setuptools_gettext-0.1.20/tests/test_setuptools_gettext.py      
2026-10-31 16:36:02.637018400 +0100
@@ -1,18 +1,22 @@
 import os
 from tempfile import TemporaryDirectory
+from typing import NoReturn
 
 import pytest
 from setuptools import Distribution
 from setuptools.errors import OptionError
 
 import setuptools_gettext
+import setuptools_gettext.install_layout
 from setuptools_gettext import (
     build_mo,
     discover_catalogs,
     find_source_files,
     gather_built_files,
+    install_mo,
     load_pyproject_config,
     parse_lang,
+    pyprojecttoml_config,
 )
 from setuptools_gettext.catalog import lang_from_dir
 
@@ -192,6 +196,213 @@
         }
 
 
+def test_package_layout_build_py_copies_generated_mo(monkeypatch):
+    with TemporaryDirectory() as td:
+        app_dir = os.path.join(td, "myapp")
+        write_file(os.path.join(app_dir, "__init__.py"))
+        locale = os.path.join(app_dir, "locale")
+        po = os.path.join(locale, "de", "LC_MESSAGES", "django.po")
+        write_file(po)
+        dist = Distribution(
+            attrs={
+                "name": "demo",
+                "packages": ["myapp"],
+                "package_dir": {"myapp": app_dir},
+            }
+        )
+        dist.script_name = "setup.py"
+        load_pyproject_config(
+            dist,
+            {
+                "source_dir": locale,
+                "build_dir": locale,
+                "install_layout": "package",
+            },
+        )
+        old_cwd = os.getcwd()
+        os.chdir(td)
+        try:
+            cmd = build_mo(dist)
+            cmd.initialize_options()
+            cmd.finalize_options()
+            compiled = run_build(cmd, monkeypatch)
+
+            build_py = dist.get_command_obj("build_py")
+            build_py.ensure_finalized()
+            build_py.build_lib = os.path.join(td, "build")
+            build_py.run()
+        finally:
+            os.chdir(old_cwd)
+
+        mo = os.path.join(locale, "de", "LC_MESSAGES", "django.mo")
+        assert compiled == [(po, mo)]
+        assert os.path.exists(
+            os.path.join(
+                td,
+                "build",
+                "myapp",
+                "locale",
+                "de",
+                "LC_MESSAGES",
+                "django.mo",
+            )
+        )
+
+
+def test_install_mo_share_layout_keeps_legacy_destination():
+    with TemporaryDirectory() as td:
+        build_dir = os.path.join(td, "build")
+        mo = os.path.join(build_dir, "de", "LC_MESSAGES", "django.mo")
+        write_file(mo)
+        install_dir = os.path.join(td, "install")
+        dist = Distribution(attrs={"name": "demo"})
+        load_pyproject_config(dist, {"build_dir": build_dir})
+        cmd = install_mo(dist)
+        cmd.initialize_options()
+        cmd.install_dir = install_dir
+        cmd.finalize_options()
+
+        cmd.run()
+
+        installed = os.path.join(
+            install_dir,
+            "share",
+            "locale",
+            "de",
+            "LC_MESSAGES",
+            "django.mo",
+        )
+        assert cmd.get_outputs() == [installed]
+        assert os.path.exists(installed)
+
+
+def test_install_mo_package_layout_installs_inside_package():
+    with TemporaryDirectory() as td:
+        app_dir = os.path.join(td, "myapp")
+        write_file(os.path.join(app_dir, "__init__.py"))
+        build_dir = os.path.join(app_dir, "locale")
+        mo = os.path.join(build_dir, "de", "LC_MESSAGES", "django.mo")
+        write_file(mo)
+        install_dir = os.path.join(td, "install")
+        dist = Distribution(
+            attrs={
+                "name": "demo",
+                "packages": ["myapp"],
+                "package_dir": {"myapp": app_dir},
+            }
+        )
+        load_pyproject_config(
+            dist, {"build_dir": build_dir, "install_layout": "package"}
+        )
+        cmd = install_mo(dist)
+        cmd.initialize_options()
+        cmd.install_dir = install_dir
+        cmd.finalize_options()
+
+        cmd.run()
+
+        installed = os.path.join(
+            install_dir,
+            "myapp",
+            "locale",
+            "de",
+            "LC_MESSAGES",
+            "django.mo",
+        )
+        assert cmd.get_outputs() == [installed]
+        assert os.path.exists(installed)
+
+
+def test_install_mo_package_layout_installs_src_layout_package():
+    with TemporaryDirectory() as td:
+        app_dir = os.path.join(td, "src", "myapp")
+        write_file(os.path.join(app_dir, "__init__.py"))
+        build_dir = os.path.join(app_dir, "locale")
+        write_file(os.path.join(build_dir, "de", "LC_MESSAGES", "django.mo"))
+        install_dir = os.path.join(td, "install")
+        dist = Distribution(
+            attrs={
+                "name": "demo",
+                "packages": ["myapp"],
+                "package_dir": {"": os.path.join(td, "src")},
+            }
+        )
+        load_pyproject_config(
+            dist, {"build_dir": build_dir, "install_layout": "package"}
+        )
+        cmd = install_mo(dist)
+        cmd.initialize_options()
+        cmd.install_dir = install_dir
+        cmd.finalize_options()
+
+        cmd.run()
+
+        assert cmd.get_outputs() == [
+            os.path.join(
+                install_dir,
+                "myapp",
+                "locale",
+                "de",
+                "LC_MESSAGES",
+                "django.mo",
+            )
+        ]
+
+
+def test_package_layout_rejects_build_dir_outside_packages():
+    with TemporaryDirectory() as td:
+        build_dir = os.path.join(td, "locale")
+        write_file(os.path.join(build_dir, "de", "LC_MESSAGES", "django.mo"))
+        dist = Distribution(attrs={"name": "demo", "packages": ["myapp"]})
+        load_pyproject_config(
+            dist, {"build_dir": build_dir, "install_layout": "package"}
+        )
+        cmd = install_mo(dist)
+        cmd.initialize_options()
+        cmd.install_dir = os.path.join(td, "install")
+
+        with pytest.raises(OptionError, match="inside a configured package"):
+            cmd.finalize_options()
+
+
+def test_package_layout_rejects_build_dir_on_different_mount(monkeypatch):
+    with TemporaryDirectory() as td:
+        build_dir = os.path.join(td, "locale")
+        write_file(os.path.join(build_dir, "de", "LC_MESSAGES", "django.mo"))
+        dist = Distribution(attrs={"name": "demo", "packages": ["myapp"]})
+        load_pyproject_config(
+            dist, {"build_dir": build_dir, "install_layout": "package"}
+        )
+
+        def raise_value_error(_path, _parent) -> NoReturn:
+            raise ValueError("path is on mount 'c:', start on mount 'd:'")
+
+        monkeypatch.setattr(
+            setuptools_gettext.install_layout.os.path,
+            "relpath",
+            raise_value_error,
+        )
+        cmd = install_mo(dist)
+        cmd.initialize_options()
+        cmd.install_dir = os.path.join(td, "install")
+
+        with pytest.raises(OptionError, match="inside a configured package"):
+            cmd.finalize_options()
+
+
+def test_pyproject_config_registers_build_mo_before_build_py():
+    dist = Distribution()
+
+    pyprojecttoml_config(dist)
+
+    sub_commands = [
+        sub_command[0]
+        for sub_command in dist.get_command_class("build").sub_commands
+    ]
+    assert sub_commands.count("build_mo") == 1
+    assert sub_commands.index("build_mo") < sub_commands.index("build_py")
+
+
 def test_duplicate_output_paths_are_rejected():
     with TemporaryDirectory() as td:
         locale = os.path.join(td, "locale")

Reply via email to