Blame win32/gtksource_version_h.py

Packit a7d494
#!/usr/bin/python
Packit a7d494
#
Packit a7d494
# Simple utility script to generate gtksourceversion.h
Packit a7d494
Packit a7d494
import os
Packit a7d494
import sys
Packit a7d494
import argparse
Packit a7d494
Packit a7d494
from replace import replace_multi
Packit a7d494
Packit a7d494
def gen_version_h(argv):
Packit a7d494
    top_srcdir = os.path.dirname(__file__) + "\\.."
Packit a7d494
    parser = argparse.ArgumentParser(description='Generate gtksourceversion.h')
Packit a7d494
    parser.add_argument('--version', help='Version of the package',
Packit a7d494
                        required=True)
Packit a7d494
    args = parser.parse_args()
Packit a7d494
    version_info = args.version.split('.')
Packit a7d494
Packit a7d494
    version_h_replace_items = {'@GTK_SOURCE_MAJOR_VERSION@': version_info[0],
Packit a7d494
                               '@GTK_SOURCE_MINOR_VERSION@': version_info[1],
Packit a7d494
                               '@GTK_SOURCE_MICRO_VERSION@': version_info[2]}
Packit a7d494
Packit a7d494
    # Generate gtksourceversion.h
Packit a7d494
    replace_multi(top_srcdir + '/gtksourceview/gtksourceversion.h.in',
Packit a7d494
                  top_srcdir + '/gtksourceview/gtksourceversion.h',
Packit a7d494
                  version_h_replace_items)
Packit a7d494
Packit a7d494
if __name__ == '__main__':
Packit a7d494
    sys.exit(gen_version_h(sys.argv))