3
3
# Copyright 2023 Intel Corporation.
4
4
# SPDX-License-Identifier: Apache-2.0
5
5
#
6
- # Generates P4 Control Plane configuration files.
6
+ # Generates P4 Control Plane build configuration files.
7
7
#
8
8
9
9
import argparse
@@ -411,12 +411,12 @@ def resolve_path(name, value, check_path=True):
411
411
return realpath
412
412
413
413
#-----------------------------------------------------------------------
414
- # parse_args () - Parses the command-line parameters .
414
+ # create_parser () - Creates the command-line parser .
415
415
#-----------------------------------------------------------------------
416
- def parse_args ():
416
+ def create_parser ():
417
417
parser = argparse .ArgumentParser (
418
- prog = 'setup-util.py ' ,
419
- description = 'Generates build configuration file(s) for a target.' )
418
+ prog = 'p4cpconfig ' ,
419
+ description = 'Generates build configuration file for a target.' )
420
420
421
421
parser .add_argument ('--format' , '-f' , type = str ,
422
422
default = 'cmake' ,
@@ -464,9 +464,10 @@ def parse_args():
464
464
options .add_argument ('--with-ovs' , type = str2bool ,
465
465
help = 'include open vswitch' )
466
466
467
- return parser . parse_args ()
467
+ return parser
468
468
469
469
def str2bool (v ):
470
+ """Converts a string to a Boolean value."""
470
471
if isinstance (v , bool ):
471
472
return v
472
473
if v .lower () in ('yes' , 'on' , 'true' , 't' , 'y' , '1' ):
@@ -482,7 +483,8 @@ def str2bool(v):
482
483
if __name__ == '__main__' :
483
484
logging .basicConfig (level = logging .INFO )
484
485
485
- args = parse_args ()
486
+ parser = create_parser ()
487
+ args = parser .parse_args ()
486
488
process_args (args )
487
489
488
490
if errcount != 0 :
0 commit comments