- Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmodule.py
58 lines (38 loc) · 1.71 KB
/
module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c) 2024 Phil Thompson <phil@riverbankcomputing.com>
from ..argument_parserimportArgumentParser
from ..exceptionsimporthandle_exception
from ..moduleimportmodule
defmain():
""" Create the source, interface and documentation of a sip module. """
# Parse the command line.
parser=ArgumentParser("Generate a sip extension module.")
parser.add_argument('--abi-version', help="the ABI version",
metavar="MAJOR[.MINOR]")
parser.add_argument('--project', help="the PyPI project name",
metavar="NAME")
parser.add_argument('--sdist', action='store_true', default=False,
help="generate an sdist file")
parser.add_argument('--setup-cfg',
help="the name of the setup.cfg file to use", metavar="FILE")
parser.add_argument('--sip-h', action='store_true', default=False,
help="generate a sip.h file")
parser.add_argument('--sip-rst', action='store_true', default=False,
help="generate a sip.rst file")
parser.add_argument('--target-dir', help="generate files in DIR",
metavar="DIR")
parser.add_argument(dest='sip_modules', nargs=1,
help="the fully qualified name of the sip module",
metavar="module")
args=parser.parse_args()
try:
module(sip_module=args.sip_modules[0], abi_version=args.abi_version,
project=args.project, sdist=args.sdist,
setup_cfg=args.setup_cfg, sip_h=args.sip_h,
sip_rst=args.sip_rst, target_dir=args.target_dir)
exceptExceptionase:
handle_exception(e)
return0
if__name__=='__main__':
importsys
sys.exit(main())