-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.py
35 lines (28 loc) · 1006 Bytes
/
build.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
"""
The following command produces these artifacts:
- ./art/openapi.yaml
- ./art/openapi.json
- ./art/otg-convergence.proto
"""
import sys
import os
import subprocess
# supported values - local openapiart path or None
USE_OPENAPIART_DIR = None
# supported values - branch name or None
USE_OPENAPIART_BRANCH = None
OPENAPIART_REPO = "https://github.com/open-traffic-generator/openapiart.git"
if USE_OPENAPIART_DIR is not None:
sys.path.insert(0, USE_OPENAPIART_DIR)
elif USE_OPENAPIART_BRANCH is not None:
local_path = "openapiart"
if not os.path.exists(local_path):
subprocess.check_call("git clone {} && cd {} && git checkout {} && cd ..".format(OPENAPIART_REPO, local_path, USE_OPENAPIART_BRANCH), shell=True)
sys.path.insert(0, local_path)
import openapiart
openapiart.OpenApiArt(
api_files=["./api/info.yaml", "./api/api.yaml"],
protobuf_name="otg",
artifact_dir="artifacts",
generate_version_api=True,
).GeneratePythonSdk(package_name="otg")