i18n: disable 'no-wrap' on extract_messages to align wrap settings with weblate
In Weblate, the default wrap settings are used and this is not configurable. This means that .po files will have wrapping at 76 characters.
On the other hand, the 'extract_messages' method in Kallithea was configured to not wrap at all. When regenerating .po files based on a new .pot file, there could thus be wrapping changes, back and forth.
Avoid this by removing the 'no-wrap' setting and falling back to (hopefully) the same default as Weblate.
i18n: drop translations of push-to-lock strings, removed in 99edd97366e3
A few of the dropped strings had meanwhile been translated. That gave conflicts when rebasing the po update from 99edd97366e3 and to branch head. That was resolved by dropping these conflicts.
i18n: drop automaticly introduced bad translations - completely remove previously fuzzy translations, not just the fuzzy markers
This is redoing cb02ca192180, but more aggressively.
msgmerge is aggressively adding fuzzy translations of strings that vaguely resemble each other. But these translations are bad. And even more bad almost irreversible when we dropped the fuzzy markers.
"Unauthorized access to resource" is translated to "Несанкцыянаваны доступ да рэсурсу", but the same translation is also used fuzzily for very different strings. That can't be good. While the translation of a slightly similar string might be a good starting point for translators, we don't want to show such automated and invalid translations to our users. Then it is better to show the orginal english text, that at least is a clear TODO item and doesn't say anything wrong.
We thus remove these automaticly generated translations. Some of them were perhaps marked fuzzy for other reasons, and we might lose a few good translations. That is still better than having wrong translations. Translators can also just mark the translation as non-fuzzy and deal with the conflict of diverging opinion on whether the translation is good. Their statement trumps our presumption that the automated fuzzy translation is bad.
vcs: drop subprocessio __del__ - it should no longer be necessary, and it might confuse both users and garbage collector
After 8dbe46ca608f, we always explicitly close so resources can be released early.
__del__ makes it hard for the garbage collector to clean up, and it is misleading to use it as if it was a reliable "Resource acquisition is initialization" finale.
It seems to be more common to use the first approach. And we don't have a specific reason to prefer the latter. Moreover, other scripts in this repo, like 'make-release' and 'whitespacecleanup.sh' use the former too.
scripts: new maintainer script validate-minimum-dependency-versions
Automate what we can.
This script could be added later to an encompassing script 'prepare-for-release' (which would also do other release-related steps).
The trick '2> >(tee "$log" >&2)' sends the error output to the console while at the same time writing to a file. It uses bash-specific syntax (process substitution: >(...) ) See https://stackoverflow.com/a/692407/2941347 .
dev_requirements.txt: bump minimum pytest versions to a working set
Not all combinations of pytest-related packages seem to work. Trial-and-error lead to these combinations of minimum versions.
Add a minimum bound to pytest-benchmark and pytest-localserver to help pip in figuring out a suitable combination with pytest, and also to allow testing minimum combinations in the future.
Drop pytest-runner, which should not be needed unless when running tests directly from setup.py.
git: exit early if Git is found but too old (Issue #342)
The warning in the logs were too easy to miss.
It is still OK if git isn't found at all... for example if git_path configuration doesn't point at something that looks like git.
The git_path configuration already had no default, so just make the code path for that case more clean. (An easy next/alternative step could be to remove git from BACKENDS if it isn't configured ...)
The system exit is similar to what is done in 0e33880b2897 ... even though exiting from from a library might be a bit worse ...
Align the comment headers in all kallithea.po translation files: - remove the description of the file: for new translations added via Weblate, this is not updated and it'd contain 'Translations template for Kallithea'. The name of the language is already present later in the file in the metadata block. - remove 'Automatically generated' lines present in some files - add an empty line below the header block
i18n: remove source code references from kallithea.po files
Remove all comments with source code references from the kallithea.po files. Such meta data will inherently be outdated, and create unnecessary churn and repository growth, making it harder to spot actual and important changes.
None of the removed information is actually 'lost', it can be regenerated via extract_messages/msgmerge, see instructions in kallithea/i18n/how_to.
This commit is part of a series that normalizes the kallithea.po files by removing all comments, in particular source code references.
This information can be useful to translators in the future and therefore will be preserved in a separate kallithea-i18n repository with separate *-i18n branches.
This commit is part of a series that normalizes the kallithea.po files by removing all comments, in particular source code references.
Remove translations of strings that are no longer used in Kallithea.
These translations can be useful to translators in the future and therefore will be preserved in a separate kallithea-i18n repository with separate *-i18n branches.
This commit is part of a series that normalizes the kallithea.po files by removing all comments, in particular source code references.
These contributors are already present in repository history for the specified years. The entries can be removed from 'contributor_data' without impact in CONTRIBUTORS or the about page.
contributors: fix existing email-less entry of 'mikespook'
Commit 17bef51d7616 was committed as 'mikespook' without any email address. This name was thus reflected without email in the CONTRIBUTORS file.
In the i18n copyright data, a 'mikespook' _with_ email address was referenced. Assuming these two refer to the same person, add a 'name fix' to combine them.
In scripts/contributor_data.py, there are already two 'name fixes' for 'marcink' and 'Marcin Kuzminski' to align all contributions with these names to a specific name and email address.
Assuming they want to use the single email address as specified earlier, we map the entry 'marcinkuzminski' in the i18n .po files on the same name/email.
tg2: handle cache_dir configuration jumping around between TurboGears versions
Tweak 87672c1916f8 - the use of 'tg.cache_dir' turns out to not be a good idea.
TurboGears 2.4 moved 'cache_dir' configuration to the expected 'cache_dir' key, and no longer has 'tg.cache_dir' ... and also not the old 'app_conf'.'cache_dir' .
tg2: move routing mapper initialization from RootController class definition time to instantiation time
Things happened to work before, despite unfortunate code executation at import time. TurboGears 2.4 changed something, so actual serving works, but pytest fails with:
collecting ... ... data/env/lib/python2.7/site-packages/_pytest/config/__init__.py:463: in _importconftest raise ConftestImportFailure(conftestpath, sys.exc_info()) E ConftestImportFailure: (local('.../kallithea/tests/conftest.py'), (<type 'exceptions.KeyError'>, KeyError('paths',), <traceback object at 0x7fb6679030e0>))
or more useful, if raising the real exception instead of obfuscating with ConftestImportFailure:
... kallithea/tests/conftest.py:15: in <module> from kallithea.controllers.root import RootController kallithea/controllers/root.py:29: in <module> class RootController(RoutedController, BaseController): kallithea/controllers/root.py:31: in RootController mapper = make_map(config) kallithea/config/routing.py:32: in make_map rmap = Mapper(directory=config['paths']['controllers'], data/env/lib/python2.7/site-packages/tg/configuration/tgconfig.py:28: in __getitem__ return self.config_proxy.current_conf()[key] E KeyError: 'paths' _importconftest <_pytest.config.PytestPluginManager object at 0x7f20c770a3d0> .../conftest.py
In this example, in RootController, the global config object is at this time just:
The documentation stated that a theme.less file can be placed in the Kallithea root directory, but this is not true. The file is expected in kallithea/front-end to take effect.
scm: select options should be tuples - not lists with 2 elements
We use tuples in all(?) other places, so we should do the same here.
Since lists can be unpacked as tuples, it currently works to use 2-lists. But in a following change for "correct" handling of webhelpers.select when using webhelpers2.select, we want to give special handling to tuples vs strings vs Options. We don't want to add list to that list.
Performing ssh actions towards Kallithea via an IPv6 connection gave the following error:
$ hg incoming ssh://kallithea@example.com/repo remote: Traceback (most recent call last): remote: File ".../bin/kallithea-cli", line 11, in <module> remote: load_entry_point('Kallithea', 'console_scripts', 'kallithea-cli')() remote: File ".../python2.7/site-packages/click/core.py", line 764, in __call__ remote: return self.main(*args, **kwargs) remote: File ".../python2.7/site-packages/click/core.py", line 717, in main remote: rv = self.invoke(ctx) remote: File ".../python2.7/site-packages/click/core.py", line 1137, in invoke remote: return _process_result(sub_ctx.command.invoke(sub_ctx)) remote: File ".../python2.7/site-packages/click/core.py", line 956, in invoke remote: return ctx.invoke(self.callback, **ctx.params) remote: File ".../python2.7/site-packages/click/core.py", line 555, in invoke remote: return callback(*args, **kwargs) remote: File ".../kallithea/bin/kallithea_cli_base.py", line 79, in runtime_wrapper remote: return annotated(*args, **kwargs) remote: File ".../kallithea/bin/kallithea_cli_ssh.py", line 74, in ssh_serve remote: vcs_handler.serve(user_id, key_id, client_ip) remote: File ".../kallithea/lib/vcs/backends/ssh.py", line 65, in serve remote: self.authuser = AuthUser.make(dbuser=dbuser, ip_addr=client_ip) remote: File ".../kallithea/lib/auth.py", line 407, in make remote: if not check_ip_access(source_ip=ip_addr, allowed_ips=allowed_ips): remote: File ".../kallithea/lib/auth.py", line 860, in check_ip_access remote: if ipaddr.IPAddress(source_ip) in ipaddr.IPNetwork(ip): remote: File ".../kallithea/lib/ipaddr.py", line 76, in IPAddress remote: remote: ValueError: '2' does not appear to be an IPv4 or IPv6 address abort: no suitable response from remote hg!
This was caused by IPv4-exclusive parsing of the SSH_CONNECTION variable. With an IPv6 address starting with '2a02:1810:', only the first '2' would survive.
According to 'man 1 ssh':
SSH_CONNECTION Identifies the client and server ends of the con‐ nection. The variable contains four space-sepa‐ rated values: client IP address, client port num‐ ber, server IP address, and server port number.
So, the client IP address will be the first space-separated word, regardless of IPv4 or IPv6. Use that knowledge without further parsing.