Skip to content

Commit c87c908

Browse files
Working on getting buildAndDeploy working on mac
1 parent 9c09fa2 commit c87c908

5 files changed

Lines changed: 19 additions & 38 deletions

File tree

bin/buildAndDeploy.py

100644100755
Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ def runI18n4go(path: str) -> None:
9696
# TODO: Support linux too I guess.
9797
if isWindows():
9898
binary = f"{binary}.exe"
99-
cmd = f"{binary} -c checkup -q i18n -v -d {plugin_dir}"
100-
print(f"[turquoise2]Running: {cmd}")
99+
cmd = [binary, "-c checkup", "-q i18n", "-v", f"-d {plugin_dir}"]
100+
print("[turquoise2]Running: " + " ".join(cmd))
101101
result = subprocess.run(cmd, capture_output=True, text=True)
102102
# We have some mismatching lines, lets fix that.
103103
missmatch = ""
@@ -206,8 +206,8 @@ def genBinData() -> None:
206206
goBindata = './bin/go-bindata'
207207
if isWindows():
208208
goBindata = f'{goBindata}.exe'
209-
goBindata = f'{goBindata} -pkg resources -o plugin/resources/i18n_resources.go plugin/i18n/resources'
210-
print(f"[turquoise2]Building I18N: {goBindata}")
209+
goBindata = [goBindata, "-pkg=resources", "-o=plugin/resources/i18n_resources.go", "plugin/i18n/resources"]
210+
print("[turquoise2]Building I18N: " + " ".join(goBindata))
211211
result = subprocess.run(goBindata, capture_output=True)
212212
if result.returncode > 0:
213213
print(f"\t[red]{result.stderr.decode('ascii')}")
@@ -249,25 +249,6 @@ def setVersion(self, version: str) -> None:
249249
sl_go.write_text(updated)
250250
print(f"[turquoise2]Updated {sl_go} PLUGIN_VERSION {old_v[1]} -> {version}")
251251

252-
def commitChanges(self):
253-
"""Commits any expected changes from the build"""
254-
cmds = [
255-
f"git add {os.path.join(self.cwd, 'plugin', 'i18n', 'resources', '*.json')}",
256-
f"git add {os.path.join(self.cwd, 'plugin', 'resources', '*i18n_resources.go')}",
257-
'git commit --message="updating I18N files from buildAndDeploy"',
258-
259-
]
260-
status = 'git status -s --untracked-files=no'
261-
262-
result = subprocess.run(status, capture_output=True, text=True)
263-
print(result.stdout)
264-
changes = re.match('resources', result.stdout)
265-
if changes:
266-
for cmd in cmds:
267-
print(f"[turquoise2]{cmd}")
268-
subprocess.run(cmd)
269-
else:
270-
print("[green]No changes to commit!")
271252

272253
def deploy(self):
273254
"""Uploads binaries to IBM COS"""
@@ -349,7 +330,8 @@ def goBuild(self, theOs: str, theArch: str) -> None:
349330
binaryName = f"{binaryName}.exe"
350331
buildCmd = f"go build -ldflags \"-s -w\" -o {binaryName} ."
351332
print(f"[turquoise2]Running {buildCmd}")
352-
subprocess.run(buildCmd)
333+
# This command basically requires shell=True on mac because -ldflags doesn't get parsed properly withoutit.
334+
subprocess.run(buildCmd, shell=True)
353335

354336
@click.group()
355337
@click.pass_context
@@ -408,7 +390,6 @@ def i18n(ctx):
408390
"""Checks and builds the i18n files"""
409391
runI18n4go(ctx.obj.getdir())
410392
genBinData()
411-
ctx.obj.commitChanges()
412393

413394
if __name__ == '__main__':
414395
try:

bin/go-bindata

134 KB
Binary file not shown.

bin/i18n4go

100644100755
File mode changed.

plugin/i18n/resources/en_US.all.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10371,4 +10371,4 @@
1037110371
"id": "{{.imageId}} was {{.action}} from datacenter {{.datacenter}}",
1037210372
"translation": "{{.imageId}} was {{.action}} from datacenter {{.datacenter}}"
1037310373
}
10374-
]
10374+
]

plugin/resources/i18n_resources.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)