Skip to content

Commit 721549a

Browse files
authored
Merge pull request #406 from alicevision/bin_meshoomCompute
[bin] use sys.exit + build meshroom_compute executable
2 parents 5694242 + b147788 commit 721549a

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

bin/meshroom_compute

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22
import argparse
3+
import sys
34

45
import meshroom
56
meshroom.setupEnvironment()
@@ -47,7 +48,7 @@ if args.node:
4748
for chunk in chunks:
4849
if chunk.status.status in submittedStatuses:
4950
print('Error: Node is already submitted with status "{}". See file: "{}"'.format(chunk.status.status.name, chunk.statusFile))
50-
# exit(-1)
51+
# sys.exit(-1)
5152
if args.iteration != -1:
5253
chunk = node.chunks[args.iteration]
5354
chunk.process(args.forceCompute)
@@ -56,7 +57,7 @@ if args.node:
5657
else:
5758
if args.iteration != -1:
5859
print('Error: "--iteration" only make sense when used with "--node".')
59-
exit(-1)
60+
sys.exit(-1)
6061
toNodes = None
6162
if args.toNode:
6263
toNodes = graph.findNodes([args.toNode])

bin/meshroom_newNodeType

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ elif sys.stdin.isatty():
8686
if not inputCmdLineDoc:
8787
print('No input documentation.')
8888
print('Usage: YOUR_COMMAND --help | {cmd}'.format(cmd=os.path.splitext(__file__)[0]))
89-
exit(-1)
89+
sys.exit(-1)
9090

9191

9292
fileStr = '''import sys
@@ -131,7 +131,7 @@ elif args.parser == 'basic':
131131
args_re = re.compile('()--(?P<argLongName>\w+)()()()()')
132132
else:
133133
print('Error: Unknown input parser "{}"'.format(args.parser))
134-
exit(-1)
134+
sys.exit(-1)
135135

136136
choiceValues1_re = re.compile('\* (?P<value>\w+):')
137137
choiceValues2_re = re.compile('\((?P<value>.+?)\)')
@@ -299,7 +299,7 @@ outputFilepath = os.path.join(args.output, args.node + '.py')
299299

300300
if not args.force and os.path.exists(outputFilepath):
301301
print('Plugin "{}" already exists "{}".'.format(args.node, outputFilepath))
302-
exit(-1)
302+
sys.exit(-1)
303303

304304
with open(outputFilepath, 'w') as pluginFile:
305305
pluginFile.write(fileStr)

bin/meshroom_photogrammetry

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import argparse
33
import os
4+
import sys
45

56
import meshroom
67
meshroom.setupEnvironment()
@@ -63,7 +64,7 @@ def getOnlyNodeOfType(g, nodeType):
6364

6465
if not args.input and not args.inputImages:
6566
print('Nothing to compute. You need to set --input or --inputImages.')
66-
exit(1)
67+
sys.exit(1)
6768

6869
views, intrinsics = [], []
6970
# Build image files list from inputImages arguments
@@ -109,7 +110,7 @@ if args.scale > 0:
109110
if args.save:
110111
graph.save(args.save)
111112
print('File successfully saved:', args.save)
112-
exit(0)
113+
sys.exit(0)
113114

114115
# setup cache directory
115116
graph.cacheDir = args.cache if args.cache else meshroom.core.defaultCacheFolder

bin/meshroom_statistics

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import argparse
33
import os
4+
import sys
45
from pprint import pprint
56
from collections import Iterable, defaultdict
67

@@ -44,7 +45,7 @@ args = parser.parse_args()
4445

4546
if not os.path.exists(args.graphFile):
4647
print('ERROR: No graph file "{}".'.format(args.graphFile))
47-
exit(-1)
48+
sys.exit(-1)
4849

4950
graph = pg.loadGraph(args.graphFile)
5051

bin/meshroom_status

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import argparse
33
import os
4+
import sys
45
from pprint import pprint
56

67
import meshroom
@@ -22,7 +23,7 @@ args = parser.parse_args()
2223

2324
if not os.path.exists(args.graphFile):
2425
print('ERROR: No graph file "{}".'.format(args.node, args.graphFile))
25-
exit(-1)
26+
sys.exit(-1)
2627

2728
graph = meshroom.core.graph.loadGraph(args.graphFile)
2829

@@ -32,7 +33,7 @@ if args.node:
3233
node = graph.node(args.node)
3334
if node is None:
3435
print('ERROR: node "{}" does not exist in file "{}".'.format(args.node, args.graphFile))
35-
exit(-1)
36+
sys.exit(-1)
3637
for chunk in node.chunks:
3738
print('{}: {}'.format(chunk.name, chunk.status.status.name))
3839
if args.verbose:

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def __init__(self, script, initScript=None, base=None, targetName=None, icons=No
113113
"bin/meshroom_photogrammetry"
114114
)
115115

116+
meshroomCompute = PlatformExecutable(
117+
"bin/meshroom_compute"
118+
)
119+
120+
116121
setup(
117122
name="Meshroom",
118123
description="Meshroom",
@@ -127,5 +132,5 @@ def __init__(self, script, initScript=None, base=None, targetName=None, icons=No
127132
],
128133
version=meshroom.__version__,
129134
options={"build_exe": build_exe_options},
130-
executables=[meshroomExe, meshroomPhotog],
135+
executables=[meshroomExe, meshroomPhotog, meshroomCompute],
131136
)

0 commit comments

Comments
 (0)