~ubuntu-branches/ubuntu/trusty/serf/trusty-security

« back to all changes in this revision

Viewing changes to build/gen_def.py

  • Committer: Bazaar Package Importer
  • Author(s): Peter Samuelson
  • Date: 2011-06-27 18:09:28 UTC
  • mfrom: (1.2.5 upstream)
  • mto: (3.3.1 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20110627180928-ybwzd3hmx82nu3ir
Tags: 1.0.0~0+svn1514-1
* New upstream snapshot.
  - patches/abi-0.x: Remove as obsolete.
  - patches/kqueue: Forward-port.
  - Bump ABI: libserf0.7{,-dbg} -> libserf1{,-dbg}
  - patches/ip6-localhost: New patch: temporary (I hope) workaround for
    IPv4 / IPv6 confusion in testsuite.
* Implement Multi-Arch: same.
* libserf-dev Conflicts: libserf-0-0-dev, not Breaks.  Thanks, lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#
22
22
# Typically, this script is used like:
23
23
#
24
 
#    C:\PATH> python build/gen_def.py serf.h serf_bucket_types.h serf_bucket_util.h > serf.def
 
24
#    C:\PATH> python build/gen_def.py serf.h serf_bucket_types.h serf_bucket_util.h > build/serf.def
25
25
#
26
26
 
27
27
import re
41
41
_funcs = re.compile(r'^(?:(?:\w+|\*) )+\*?(serf_[a-z][a-z_0-9]*)\(',
42
42
                    re.MULTILINE)
43
43
 
44
 
def extract_funcs(fname):
45
 
  funcs = [ ]
46
 
  for name in _funcs.findall(open(fname).read()):
47
 
    funcs.append(name)
48
 
  return funcs
 
44
# This regex parses the bucket type definitions which look like:
 
45
#
 
46
#    extern const serf_bucket_type_t serf_bucket_type_FOO;
 
47
#
 
48
_types = re.compile(r'^extern const serf_bucket_type_t (serf_[a-z_]*);',
 
49
                    re.MULTILINE)
 
50
 
 
51
 
 
52
def extract_exports(fname):
 
53
  content = open(fname).read()
 
54
  exports = [ ]
 
55
  for name in _funcs.findall(content):
 
56
    exports.append(name)
 
57
  for name in _types.findall(content):
 
58
    exports.append(name)
 
59
  return exports
49
60
 
50
61
 
51
62
if __name__ == '__main__':
53
64
  import sys
54
65
  print("EXPORTS")
55
66
  for fname in sys.argv[1:]:
56
 
    for func in extract_funcs(fname):
 
67
    for func in extract_exports(fname):
57
68
      print(func)