import argparse import textwrap from pathlib import Path
# Disable line length warnings as wrapping the C code templates would be hard # flake8: noqa: E501
def gen_versions_macros(args, current_major_version, current_minor_version, current_micro_version): with args.out_path.open("w", encoding="utf-8") as ofile, args.in_path.open( "r", encoding="utf-8"
) as ifile: for line in ifile.readlines(): if"@GDK_VERSIONS@"in line:
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/ #define GDK_MAJOR_VERSION ({current_major_version})
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/ #define GDK_MINOR_VERSION ({current_minor_version})
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/ #define GDK_MICRO_VERSION ({current_micro_version}) """
)
) for minor in range(0, current_minor_version + 2, 2):
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_VERSION_{current_major_version}_{minor}:
*
* A macro that evaluates to the {current_major_version}.{minor} version of GTK, in a format
* that can be used by the C pre-processor.
*
* Since: {current_major_version}.{minor}
*/ #define GDK_VERSION_{current_major_version}_{minor} (G_ENCODE_VERSION ({current_major_version}, {minor})) """
)
) else:
ofile.write(line)
def gen_visibility_macros(args, current_major_version, current_minor_version, current_micro_version): """
Generates a set of macros for each minor stable version of GTK
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.