Skip to content

Commit

Permalink
Merge commit '57e783f8cb3c4eeb3a31c262ea8a342cc52bb450'
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechtrefny committed Jul 11, 2023
2 parents d3c6d02 + 57e783f commit 479f56b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
27 changes: 27 additions & 0 deletions translation-canary/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,30 @@ warnings should be addressed instead of silently ignored as they scroll by in
the build output. To use the script in a package that uses the gettext template
files from autopoint or gettextize, set XGETTEXT=/path/to/xgettext_werror.sh in
Makevars.


Usage as a subtree
==================

Anaconda and Blivet use translation canary as a git subtree. If you need to
change the canary for these projects, follow these steps:

1. Make changes and test them in the context of your project.

2. Copy these changes to the ``translation-canary`` repo and make a pull
request with these changes.

3. After that PR is merged, go to Anaconda or Blivet repo root and run::

dnf install git-subtree
git subtree pull --prefix translation-canary/ git@github.com:rhinstaller/translation-canary.git master --squash

This produces a squash commit with some ancient parent, and then also
a merge commit that merges the squash commit into your current ``HEAD``.

4. Make a topic branch and PR for merging what you got into your project. For
the purpose of making branches and PRs, the commits above are not special
in any way.

Note: There is no way to detect subtree presence, it behaves as regular files
and directories.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@

# Gather tests from this directory
import pkgutil
import importlib

_tests = []
for finder, mod_name, _ispkg in pkgutil.iter_modules(__path__):
# Skip __main__
if mod_name == "__main__":
continue

# Load the module
module = finder.find_module(mod_name).load_module()
full_name = "{}.{}".format(__name__, mod_name)
module = importlib.import_module(full_name)

# Look for attributes that start with 'test_' and add them to the test list
for attrname, attr in module.__dict__.items():
Expand Down
5 changes: 4 additions & 1 deletion translation-canary/translation_canary/translated/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@

# Gather tests from this directory
import pkgutil
import importlib

for finder, mod_name, _ispkg in pkgutil.iter_modules(__path__):
# Skip __main__
if mod_name == "__main__":
continue

# Load the module
module = finder.find_module(mod_name).load_module(mod_name)
full_name = "{}.{}".format(__name__, mod_name)
module = importlib.import_module(full_name)

# Look for attributes that start with 'test_' and add them to the test list
for attrname, attr in module.__dict__.items():
Expand Down

0 comments on commit 479f56b

Please sign in to comment.