python: Fix stripping deprecated functionality.

* lang/python/Makefile.am (gpgme.h): Add script as input.
* lang/python/gpgme-h-clean.py (deprec_func): Also match struct
members.
(line_break): Fix matching on struct members.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-06-08 16:51:35 +02:00
parent 990492ea4f
commit 8426304b67
2 changed files with 8 additions and 3 deletions

View File

@ -20,7 +20,7 @@ EXTRA_DIST = README.rst
SUBDIRS = tests
# Cleanup gpgme.h from deprecated functions and typedefs.
gpgme.h: ../../src/gpgme.h
gpgme.h: ../../src/gpgme.h $(srcdir)/gpgme-h-clean.py
$(PYTHON) $(srcdir)/gpgme-h-clean.py $< >$@
# For VPATH builds we need to copy some files because Python's

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python3
# Copyright (C) 2016 g10 Code GmbH
# Copyright (C) 2004,2008 Igor Belyi <belyi@users.sourceforge.net>
#
# This library is free software; you can redistribute it and/or
@ -21,8 +23,11 @@ if len(sys.argv) < 2:
sys.stderr.write("Usage: %s gpgme.h\n" % sys.argv[0])
sys.exit(1)
deprec_func=re.compile('^(.*typedef.*|.*\(.*\))\s*_GPGME_DEPRECATED;\s*',re.S)
line_break=re.compile(';|\\$|\\x0c|^\s*#');
deprec_func = re.compile(r'^(.*typedef.*|.*\(.*\)|[^#]+\s+.+)'
+ r'\s*_GPGME_DEPRECATED(_OUTSIDE_GPGME)?;\s*',
re.S)
line_break = re.compile(';|\\$|\\x0c|^\s*#|{');
try:
gpgme = open(sys.argv[1])
tmp = gpgme.readline()