Skip to content

Commit

Permalink
fix(bindgen): Do not output version option
Browse files Browse the repository at this point in the history
Internal --version CLI flag.
  • Loading branch information
thewtex committed Apr 24, 2023
1 parent 1ceb67b commit ee7513a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,11 @@ async def parse_string_decompress_async(

output_web_worker = None
output_list = []
print(dir(outputs))
outputs_object_map = outputs.as_object_map()
for output_name in outputs.object_keys():
if output_name == 'webWorker':
output_web_worker = outputs_object_map[output_name]
else:
print(output_name)
print(type(outputs_object_map[output_name]))
print(outputs_object_map[output_name].constructor.name)
print(outputs_object_map[output_name])
output_list.append(to_py(outputs_object_map[output_name]))

js_resources.web_worker = output_web_worker
Expand Down
10 changes: 5 additions & 5 deletions src/bindgen/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function functionModuleArgs(interfaceJson) {
functionArgs += ` ${snakeCase(value.name)}: ${pythonType},\n`
})
interfaceJson['parameters'].forEach((value) => {
if (value.name === "memory-io") {
if (value.name === "memory-io" || value.name === "version") {
return
}
const pythonType = interfaceJsonTypeToPythonType.get(value.type)
Expand Down Expand Up @@ -253,7 +253,7 @@ function functionModuleDocstring(interfaceJson) {
docstring += ` ${value.description}\n\n`
})
interfaceJson['parameters'].forEach((value) => {
if (value.name === "memory-io") {
if (value.name === "memory-io" || value.name === "version") {
return
}
const pythonType = interfaceJsonTypeToPythonType.get(value.type)
Expand Down Expand Up @@ -364,7 +364,7 @@ from itkwasm import (

args += " # Options\n"
interfaceJson.parameters.forEach((parameter) => {
if (parameter.name === 'memory-io') {
if (parameter.name === 'memory-io' || parameter.name === 'version') {
// Internal
return
}
Expand Down Expand Up @@ -548,7 +548,7 @@ from itkwasm.pyodide import (

let options = ''
interfaceJson.parameters.forEach((parameter) => {
if (parameter.name === 'memory-io') {
if (parameter.name === 'memory-io' || parameter.name === 'version') {
// Internal
return
}
Expand Down Expand Up @@ -602,7 +602,7 @@ from itkwasm import (
functionArgsToPass += `${snakeCase(value.name)}, `
})
interfaceJson['parameters'].forEach((value) => {
if (value.name === "memory-io") {
if (value.name === "memory-io" || value.name === "version") {
return
}
functionArgsToPass += `${snakeCase(value.name)}=${snakeCase(value.name)}, `
Expand Down
6 changes: 3 additions & 3 deletions src/bindgen/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=

// -----------------------------------------------------------------
// Options module
const filteredParameters = interfaceJson.parameters.filter(p => { return p.name !== 'memory-io'})
const filteredParameters = interfaceJson.parameters.filter(p => { return p.name !== 'memory-io' && p.name !== 'version'})
const haveParameters = !!filteredParameters.length

// track unique output types in this set
Expand All @@ -222,7 +222,7 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=
let optionsContent = ''
let optionsInterfaceContent = `interface ${modulePascalCase}Options {\n`
interfaceJson.parameters.forEach((parameter) => {
if (parameter.name === 'memory-io') {
if (parameter.name === 'memory-io' || parameter.name === 'version') {
// Internal
return
}
Expand Down Expand Up @@ -416,7 +416,7 @@ import {\n`
functionContent += " // Options\n"
functionContent += " args.push('--memory-io')\n"
interfaceJson.parameters.forEach((parameter) => {
if (parameter.name === 'memory-io') {
if (parameter.name === 'memory-io' || parameter.name === 'version') {
// Internal
return
}
Expand Down

0 comments on commit ee7513a

Please sign in to comment.