Skip to content

Commit bc88ef8

Browse files
committed
workflow name
1 parent dc46ffe commit bc88ef8

File tree

3 files changed

+20
-36
lines changed

3 files changed

+20
-36
lines changed

pbat/Opts.py

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Opts:
2929
need_patch_var: bool = False
3030
env_policy: bool = False
3131
use_patch_var: bool = False
32+
workflow_name: str = 'main'
3233

3334
def copy_opts(opts: Opts) -> Opts:
3435
res = Opts()

pbat/core.py

+14-36
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def save_workflow(path, steps, opts: Opts, githubdata: GithubData):
153153

154154
main['steps'] = steps
155155

156-
data = {"name":"main","on":on_}
156+
data = {"name":opts.workflow_name, "on":on_}
157157

158158
if opts.msys2_msystem:
159159
data["env"] = {
@@ -617,12 +617,18 @@ def kwarg_value(kwargs, *names):
617617
if value is not None:
618618
return value
619619

620+
def use_7z(ctx, opts):
621+
opts.env_path.append('C:\\Program Files\\7-Zip')
620622

621-
def macro_unzip(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: GithubData):
623+
def use_cmake(ctx, opts):
624+
opts.env_path.append('C:\\Program Files\\CMake\\bin')
625+
626+
def use_ninja(ctx, opts):
627+
pass
622628

623-
if not ctx.github:
624-
opts.env_path.append('C:\\Program Files\\7-Zip')
629+
def macro_unzip(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: GithubData):
625630

631+
use_7z(ctx, opts)
626632
src = args[0]
627633

628634
if len(args) == 2:
@@ -652,8 +658,7 @@ def macro_unzip(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: Githu
652658

653659
def macro_zip(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: GithubData):
654660

655-
if not ctx.github:
656-
opts.env_path.append('C:\\Program Files\\7-Zip')
661+
use_7z(ctx, opts)
657662

658663
COMPRESSION_MODE = {
659664
"-mx0": "copy",
@@ -1097,7 +1102,7 @@ def macro_use(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: GithubD
10971102
opts.env_path.append('C:\\mysql-{}-winx64\\bin'.format(ver))
10981103
opts.env_path.append('C:\\mysql-{}-winx64\\lib'.format(ver))
10991104
elif app == '7z':
1100-
opts.env_path.append('C:\\Program Files\\7-Zip')
1105+
use_7z(ctx, opts)
11011106
elif app == 'git':
11021107
opts.env_path.append('C:\\Program Files\\Git\\cmd')
11031108
elif app == 'sed':
@@ -1107,36 +1112,9 @@ def macro_use(name, args, kwargs, ret, opts: Opts, ctx: Ctx, githubdata: GithubD
11071112
elif app == 'perl':
11081113
opts.env_path.append('C:\\Strawberry\\perl\\bin')
11091114
elif app == 'cmake':
1110-
if not ctx.github:
1111-
opts.env_path.append('C:\\Program Files\\CMake\\bin')
1115+
use_cmake(ctx, opts)
11121116
elif app == 'ninja':
1113-
if ctx.github:
1114-
opts.env_path.append('C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja')
1115-
opts.env_path.append('C:\\Program Files (x86)\\Android\\android-sdk\\cmake\\3.22.1\\bin')
1116-
else:
1117-
opts.env_path.append('C:\\Program Files\\Meson')
1118-
elif app == 'mingw':
1119-
if ver in ['5', '5.4.0', '540_32']:
1120-
opts.env_path.append('C:\\mingw540_32\\bin')
1121-
elif ver in ['8', '8.1.0', '810_64']:
1122-
opts.env_path.append('C:\\Qt\\Tools\\mingw810_64\\bin')
1123-
elif ver in ['11', '11.2.0', '1120_64']:
1124-
opts.env_path.append('C:\\mingw1120_64\\bin')
1125-
else:
1126-
raise ValueError("use not implemented for {} {}".format(app, ver))
1127-
elif app == 'qt':
1128-
if ver == '6':
1129-
ver = '6.7.1'
1130-
elif ver == '5':
1131-
ver = '5.15.2'
1132-
elif ver == '4':
1133-
ver = '4.8.7'
1134-
if ver.startswith('6.'):
1135-
opts.env_path.append('C:\\Qt\\{}\\mingw1120_64\\bin'.format(ver))
1136-
elif ver.startswith('5.'):
1137-
opts.env_path.append('C:\\Qt\\{}\\mingw81_64\\bin'.format(ver))
1138-
elif ver.startswith('4.'):
1139-
opts.env_path.append('C:\\Qt-{}\\bin'.format(ver))
1117+
use_ninja(ctx, opts)
11401118
elif app == 'msys':
11411119
if ver is None:
11421120
ver = 'ucrt64'

pbat/parsescript.py

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def parse_statement(line, opts: Opts) -> bool:
9696
opts.curl_proxy = m.group(1).rstrip()
9797
return True
9898

99+
m = re.search('^workflow[_-]name (.*)', line)
100+
if m:
101+
opts.workflow_name = m.group(1).strip()
102+
return True
103+
99104
return False
100105

101106
def parse_order(line):

0 commit comments

Comments
 (0)