|
| 1 | +import argparse |
1 | 2 | from collections import defaultdict |
2 | 3 | import json |
3 | 4 | import os.path |
|
11 | 12 | from pipeline.translator import PythonBuilder |
12 | 13 | from pipeline.utils import clone_sources, SchemaLoader, InstanceLoader |
13 | 14 |
|
| 15 | + |
14 | 16 | include_instances = True # to speed up the build during development, set this to False |
15 | 17 |
|
16 | | -print("*********************************************************") |
17 | | -print(f"Triggering the generation of Python package for openMINDS") |
18 | | -print("*********************************************************") |
| 18 | +parser = argparse.ArgumentParser(prog=sys.argv[0], description="Generate Python package for openMINDS") |
| 19 | +parser.add_argument('--branch', help="The branch to build from ('main' or 'development')", default="main") |
| 20 | +args = parser.parse_args() |
| 21 | + |
| 22 | +print("*******************************************************************************") |
| 23 | +print(f"Triggering the generation of Python package for openMINDS, from the {args.branch} branch") |
| 24 | +print("*******************************************************************************") |
19 | 25 |
|
20 | 26 | # Step 0 - read code for additional methods |
21 | 27 | additional_methods = {} |
22 | 28 | with open("pipeline/src/additional_methods/by_name.py.txt") as fp: |
23 | 29 | code = fp.read() |
24 | 30 | additional_methods["by_name"] = code |
25 | 31 |
|
26 | | -# Step 1 - clone central repository in main branch to get the latest sources |
27 | | -clone_sources() |
| 32 | +# Step 1 - clone central repository in main or development branch to get the latest sources |
| 33 | +clone_sources(args.branch) |
28 | 34 | schema_loader = SchemaLoader() |
29 | 35 | instance_loader = InstanceLoader() |
30 | 36 | if os.path.exists("target"): |
|
105 | 111 | autoescape=select_autoescape() |
106 | 112 | ) |
107 | 113 | context = { |
108 | | - "version": "0.2.3", |
| 114 | + "version": "0.3.0", |
109 | 115 | } |
| 116 | +if args.branch == "development": |
| 117 | + context["version"] += ".dev" |
| 118 | + |
110 | 119 | with open("target/pyproject.toml", "w") as fp: |
111 | 120 | contents = env.get_template("pipeline/src/pyproject_template.toml.txt").render(context) |
112 | 121 | fp.write(contents) |
|
0 commit comments