5
5
from geophires_x_schema_generator import GeophiresXSchemaGenerator
6
6
from geophires_x_schema_generator import HipRaXSchemaGenerator
7
7
8
- if __name__ == '__main__' :
9
- parser = argparse .ArgumentParser ()
10
- parser .add_argument ('--build-in-src' , required = False , choices = [True , False ], default = True )
11
- parser .add_argument ('--build-path' , required = False )
12
- args = parser .parse_args ()
13
- build_in_src = args .build_in_src
14
8
9
+ def generate_schemas (build_in_src : bool , build_path : str | Path ) -> None :
15
10
build_dir = Path (Path (__file__ ).parent )
16
- if not args . build_in_src :
11
+ if not build_in_src :
17
12
build_dir = Path (Path (__file__ ).parent .parent .parent , 'build' )
18
13
19
- if args . build_path :
20
- build_dir = Path (args . build_path )
14
+ if build_path :
15
+ build_dir = Path (build_path )
21
16
22
17
build_dir .mkdir (exist_ok = True )
23
18
@@ -44,3 +39,13 @@ def build(json_file_name_prefix: str, generator: GeophiresXSchemaGenerator, rst_
44
39
45
40
build ('geophires-' , GeophiresXSchemaGenerator (), 'parameters.rst' )
46
41
build ('hip-ra-x-' , HipRaXSchemaGenerator (), 'hip_ra_x_parameters.rst' )
42
+
43
+
44
+ if __name__ == '__main__' :
45
+ parser = argparse .ArgumentParser ()
46
+ parser .add_argument ('--build-in-src' , required = False , choices = [True , False ], default = True )
47
+ parser .add_argument ('--build-path' , required = False )
48
+ args = parser .parse_args ()
49
+ build_in_src_ = args .build_in_src
50
+ build_path_ = args .build_path if args .build_path else None
51
+ generate_schemas (build_in_src_ , build_path_ )
0 commit comments