Skip to content

Commit 15d61d5

Browse files
committed
Cosmetic enhancements
1 parent dad7ac2 commit 15d61d5

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

depinst/depinst.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ def vprint( level, *args ):
2424
print( *args )
2525

2626

27+
class CommandExecutionError(Exception):
28+
pass
29+
30+
31+
class DependencyCycleError(Exception):
32+
pass
33+
34+
2735
def is_module( m, gm ):
2836

2937
return ( 'libs/' + m ) in gm
@@ -91,8 +99,7 @@ def scan_header_dependencies( f, x, gm, deps, dep_path ):
9199

92100
elif len(dep_path) > 1 and mod == dep_path[0]:
93101

94-
dep_path = dep_path + [ mod ]
95-
raise DependencyCycle( 'Dependency cycle detected: ' + ' -> '.join(dep_path) )
102+
raise DependencyCycleError( 'Dependency cycle detected: ' + ' -> '.join( dep_path + [mod] ) )
96103

97104

98105
def scan_directory( d, x, gm, deps, dep_path ):
@@ -199,7 +206,7 @@ def install_modules( modules, git_args ):
199206
r = os.system( command );
200207

201208
if r != 0:
202-
raise Exception( "The command '%s' failed with exit code %d" % (command, r) )
209+
raise CommandExecutionError( "The command '%s' failed with exit code %d" % (command, r) )
203210

204211

205212
def install_module_dependencies( deps, x, gm, git_args, dep_path ):
@@ -229,10 +236,6 @@ def install_module_dependencies( deps, x, gm, git_args, dep_path ):
229236
return len( modules )
230237

231238

232-
class DependencyCycle(Exception):
233-
pass
234-
235-
236239
if( __name__ == "__main__" ):
237240

238241
parser = argparse.ArgumentParser( description='Installs the dependencies needed to test a Boost library.' )
@@ -324,6 +327,9 @@ class DependencyCycle(Exception):
324327
while install_module_dependencies( extra_deps, x, gm, args.git_args, [] ):
325328
pass
326329

327-
except DependencyCycle as e:
328-
print( e, file=sys.stderr )
330+
except Exception as e:
331+
332+
sys.stdout.flush()
333+
334+
print( 'Error:', e, file=sys.stderr )
329335
sys.exit(1)

0 commit comments

Comments
 (0)