File: build_matlab_toolbox3.py

package info (click to toggle)
robotraconteur 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 101,380 kB
  • sloc: cpp: 1,149,268; cs: 87,653; java: 58,127; python: 26,897; ansic: 356; sh: 152; makefile: 90; xml: 51
file content (31 lines) | stat: -rw-r--r-- 838 bytes parent folder | download
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
import argparse
import os
from pathlib import Path
import shutil
import urllib
import subprocess
import re


def main():

    with open("artifacts/main/out-matlab/rrversion.txt", "r") as f:
        tag_name = f.read().strip()

    print(f"tag_name: {tag_name}")

    build_dir = Path("build-matlab-toolbox/build")
    matlab_dir = build_dir.joinpath("matlab")

    semver_regex = r"^((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"

    semver_match = re.match(semver_regex, tag_name)

    toolbox_ver = semver_match.group(1)

    shutil.move(f"{build_dir}/RobotRaconteurMatlab.mltbx",
                f"{build_dir}/RobotRaconteurMatlab-{toolbox_ver}.mltbx")


if __name__ == "__main__":
    main()