Skip to content

Commit 965dd69

Browse files
committed
dlopen-notes: generate man page using argparse-manpage
Setting this up is a bit annoying, but then with luck we won't have to edit raw roff when new options are added.
1 parent b64dec0 commit 965dd69

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
!/debian/rules
1212
!/debian/source/format
1313
__pycache__/
14+
/dlopen-notes.1

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
all:
22

3+
dlopen-notes.1: dlopen-notes.py docs/dlopen-description.man Makefile
4+
argparse-manpage \
5+
--output=$@ \
6+
--pyfile=$< \
7+
--function=make_parser \
8+
--project-name=package-notes \
9+
--include=docs/dlopen-description.man
10+
311
install:
412
install -m 755 -D dlopen-notes.py $(DESTDIR)/usr/bin/dlopen-notes
513

dlopen-notes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def group_by_feature(filenames, notes):
118118

119119
return features
120120

121-
def parse_args():
121+
def make_parser():
122122
p = argparse.ArgumentParser(
123123
description=__doc__,
124124
allow_abbrev=False,
@@ -145,8 +145,10 @@ def parse_args():
145145
p.add_argument('-h', '--help',
146146
action='help',
147147
help='Show this help message and exit')
148+
return p
148149

149-
args = p.parse_args()
150+
def parse_args():
151+
args = make_parser().parse_args()
150152

151153
if not args.raw and args.features is None and not args.sonames:
152154
# Make --raw the default if no action is specified.

docs/dlopen-description.man

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/report the contents/
2+
.PP
3+
ELF binaries store link-time dependencies in their headers, which can be parsed
4+
by various tools. There is no machine-readable metadata about dependencies
5+
loaded at build time via
6+
.BR \%dlopen (3)
7+
available by default. The ELF Dlopen Metadata specification aims to fill this
8+
gap, by defining a common format.
9+
.PP
10+
This tool allows parsing such a note, and printing out the result in various
11+
formats.

0 commit comments

Comments
 (0)