Skip to content

Commit 32231fa

Browse files
committed
Add CLI option to print out all symbols
1 parent 5656fd9 commit 32231fa

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Tools/build/smelly.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env python
2-
# Script checking that all symbols exported by libpython start with Py or _Py
2+
"""Check exported symbols
33
4+
Check that all symbols exported by CPython (libpython, stdlib extension
5+
modules, and similar) start with Py or _Py, or are covered by an exception.
6+
"""
7+
8+
import argparse
49
import dataclasses
510
import functools
611
import pathlib
@@ -136,6 +141,12 @@ def get_extension_libraries():
136141

137142

138143
def main():
144+
parser = argparse.ArgumentParser(
145+
description=__doc__.split('\n', 1)[-1])
146+
parser.add_argument('-v', '--verbose', action='store_true',
147+
help='be verbose (currently: print out all symbols)')
148+
args = parser.parse_args()
149+
139150
libraries = []
140151

141152
# static library
@@ -161,9 +172,11 @@ def main():
161172
smelly_symbols = []
162173
for library in libraries:
163174
symbols = get_exported_symbols(library)
164-
print(f"{library.path}: {len(symbols)} symbol(s) found")
175+
if args.verbose:
176+
print(f"{library.path}: {len(symbols)} symbol(s) found")
165177
for symbol in sorted(symbols):
166-
print(" -", symbol.name)
178+
if args.verbose:
179+
print(" -", symbol.name)
167180
if symbol.is_smelly:
168181
smelly_symbols.append(symbol)
169182

0 commit comments

Comments
 (0)