Recent commits to derivepassphrase.git (61a16b1ca63e9019311836f286b6c2ae713710fd)
https://git.schokokeks.org/derivepassphrase.git/tree/61a16b1ca63e9019311836f286b6c2ae713710fd
Recent commits feed provided by GitList.Support SOURCE_DATE_EPOCH for .po file generationCopyright messages and the creation date will bear the source date epoch
value.
https://git.schokokeks.org/derivepassphrase.git/commit/61a16b1ca63e9019311836f286b6c2ae713710fd
software@the13thletter.info (Marco Ricci)Mon, 13 Jan 2025 16:16:12 +010061a16b1ca63e9019311836f286b6c2ae713710fdMove translation string preparation into the TranslatableString classSave for a few factory functions to make enum definitions more readable,
the normalization machinery for translatable strings belongs in their
class. I originally coded this separately because I mistakenly believed
that `typing.NamedTuple` classes cannot contain methods of their own.
https://git.schokokeks.org/derivepassphrase.git/commit/e7887804003dc277a9095956ffb7a44cb90608f4
software@the13thletter.info (Marco Ricci)Mon, 13 Jan 2025 15:49:08 +0100e7887804003dc277a9095956ffb7a44cb90608f4Properly support trimmed filenames in translation stringsThe debug translations object and the `.po` file writer now properly
support translation strings with the filename portion trimmed.
Effectively, these are separate translation strings, and as such they
need separate cache entries and separate `.po` entries.
To fully support this, the translatable string itself now knows how to
trim the filename replacement field, which the debug translations object
now honors. The `.po` writer still needs the enum name to construct the
message ID, but now it takes an optional transformed string to use
instead of the enum value, if given.
One additional minor fix to the debug translator: some of the emitted
translated messages interpolate other translated messages (such as
metavars). Thus when interpolating arguments, if the argument is
a translated string, then stringify it before interpolation. This
avoids printing the `repr` of the inner translated string, which is
otherwise very common for debug translation output.
https://git.schokokeks.org/derivepassphrase.git/commit/c0b2e8ab4fd0a0ff9dd1a158502d4f70c85d7721
software@the13thletter.info (Marco Ricci)Mon, 13 Jan 2025 14:50:03 +0100c0b2e8ab4fd0a0ff9dd1a158502d4f70c85d7721Generate debug translations automatically, in code and on the command-lineIntroduce a `DebugTranslations` object that returns the enum name of the
given message as its translation, including the parameters to be
interpolated.
Rename the `_format_pot_file` to `_format_po_file` and expand it to emit
either a template file or a debug translation `.po` file. This differs
slightly in the header, and in whether the translations are empty by
default or filled in with the enum name. The ad-hoc command-line
interface now accepts options to select the template or the debug
translation, and a way to explicitly override the declared version of
the `.po` template.
Because of negative experience with the `poedit` translations editor,
the message-ID (enum name) is no longer embedded as a (pseudo-)location
of the message string, but rather embedded as a translators' comment.
https://git.schokokeks.org/derivepassphrase.git/commit/7986212a1f6a9ab0b4ba5d983e8a9846c90b47ea
software@the13thletter.info (Marco Ricci)Mon, 13 Jan 2025 14:19:27 +01007986212a1f6a9ab0b4ba5d983e8a9846c90b47eaHide translation template enums behind a type aliasThis is getting annoying to type, and error-prone to update.
https://git.schokokeks.org/derivepassphrase.git/commit/7483aceb6e937bda5c0128129a4076b4df197d06
software@the13thletter.info (Marco Ricci)Mon, 13 Jan 2025 14:09:49 +01007483aceb6e937bda5c0128129a4076b4df197d06Merge topic branch 'harmonize-exporter-interface' into master* t/harmonize-exporter-interface:
Add changelog entry for export handler interface harmonization
Test the export handler dispatcher as well as the handlers directly
Harmonize the interface for both vault config export handlers
Accept all bytes-like objects as byte strings in the export subcommand
https://git.schokokeks.org/derivepassphrase.git/commit/a0fe6ac8f03daa0df66dfedcf7071732f79ae45b
software@the13thletter.info (Marco Ricci)Mon, 13 Jan 2025 12:40:34 +0100a0fe6ac8f03daa0df66dfedcf7071732f79ae45bAdd changelog entry for export handler interface harmonization
https://git.schokokeks.org/derivepassphrase.git/commit/9b9febbf4861ef7d6917367965677a58fd7ce1ad
software@the13thletter.info (Marco Ricci)Sat, 11 Jan 2025 20:06:57 +01009b9febbf4861ef7d6917367965677a58fd7ce1adTest the export handler dispatcher as well as the handlers directlyFor each test calling an export handler directly, also perform the test
when calling the export handler dispatcher.
https://git.schokokeks.org/derivepassphrase.git/commit/d25cdbdd2494feabfb29e8d8a6d8f695475bf7a2
software@the13thletter.info (Marco Ricci)Sat, 11 Jan 2025 19:04:57 +0100d25cdbdd2494feabfb29e8d8a6d8f695475bf7a2Harmonize the interface for both vault config export handlersHarmonize the interface for the `storeroom` and the `vault_native`
config export handlers. Specifically, introduce a common interface
`exporter.ExportVaultConfigDataFunction` which all such handlers must
adhere to, as well as a registry of handlers and a decorator for
registering handlers immediately upon definition. A new top-level
function `exporter.export_vault_config_data` adhering to this interface
will dispatch to the correct implementation, based on the handler
registry; its use is recommended over calling the handlers directly.
Though it is not encoded in the programmatic interface definition, the
intent is to use common exceptions and exception messages for common
failure modes. (The intended meanings of the exceptions are listed in
the docstring of `exporter.export_vault_config_data`.) Specifically,
introduce a new error message constant for when a given handler name is
not registered in the registry, and an exception class
`exporter.NotAVaultConfigError` for when the target path cannot be
decrypted and decoded in the requested vault config encoding format with
the given or inferred storage master key. Also update some outdated or
wrong aspects of the handler docstrings.
Additionally, the registry is empty upon definition to avoild circular
imports. A separate call to the
`exporter.find_vault_config_data_handlers` function is necessary to
populate the standard set of handlers.
`exporter.export_vault_config_data` will call this automatically.
Because of this updated interface, the
`vault_native.export_vault_native_data` handler no longer supports
specifying multiple formats to try. The caller in
`derivepassphrase.cli` already handles trying multiple formats natively,
but additionally no longer dispatches to the handler functions itself,
relying on `exporter.export_vault_config_data` for this task instead.
Finally, update the tests to include the handler registry, the
decorator, the change of parameter names and the change in handling
attempting multiple formats.
https://git.schokokeks.org/derivepassphrase.git/commit/0ecb8a91d39b699816e21d6e215878ddc50252e3
software@the13thletter.info (Marco Ricci)Sat, 11 Jan 2025 19:04:57 +01000ecb8a91d39b699816e21d6e215878ddc50252e3Accept all bytes-like objects as byte strings in the export subcommandThis is a breaking API change, because some function return types have
been widened.
https://git.schokokeks.org/derivepassphrase.git/commit/a9bd473172968db23d6b79c7a12ad7bdb9203d3c
software@the13thletter.info (Marco Ricci)Sat, 11 Jan 2025 19:04:57 +0100a9bd473172968db23d6b79c7a12ad7bdb9203d3c