Skip to content

Commit bc96ab7

Browse files
authored
Revert "depinst option to detect cycles"
1 parent 176e4ae commit bc96ab7

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

depinst/depinst.py

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def module_for_header( h, x, gm ):
7070
return None
7171

7272

73-
def scan_header_dependencies( f, x, gm, deps, dep_path ):
73+
def scan_header_dependencies( f, x, gm, deps ):
7474

7575
for line in f:
7676

@@ -89,11 +89,8 @@ def scan_header_dependencies( f, x, gm, deps, dep_path ):
8989
vprint( 1, 'Adding dependency', mod )
9090
deps[ mod ] = 0
9191

92-
elif len(dep_path) > 1 and mod == dep_path[0]:
93-
raise DependencyCycle('Dependency cycle detected: ' + '->'.join(dep_path) + '->' + mod)
9492

95-
96-
def scan_directory( d, x, gm, deps, dep_path ):
93+
def scan_directory( d, x, gm, deps ):
9794

9895
vprint( 1, 'Scanning directory', d )
9996

@@ -111,20 +108,20 @@ def scan_directory( d, x, gm, deps, dep_path ):
111108
if sys.version_info[0] < 3:
112109

113110
with open( fn, 'r' ) as f:
114-
scan_header_dependencies( f, x, gm, deps, dep_path )
111+
scan_header_dependencies( f, x, gm, deps )
115112

116113
else:
117114

118115
with open( fn, 'r', encoding='latin-1' ) as f:
119-
scan_header_dependencies( f, x, gm, deps, dep_path )
116+
scan_header_dependencies( f, x, gm, deps )
120117

121118

122-
def scan_module_dependencies( m, x, gm, deps, dirs, dep_path ):
119+
def scan_module_dependencies( m, x, gm, deps, dirs ):
123120

124121
vprint( 1, 'Scanning module', m )
125122

126123
for dir in dirs:
127-
scan_directory( os.path.join( 'libs', m, dir ), x, gm, deps, dep_path )
124+
scan_directory( os.path.join( 'libs', m, dir ), x, gm, deps )
128125

129126

130127
def read_exceptions():
@@ -200,7 +197,7 @@ def install_modules( modules, git_args ):
200197
raise Exception( "The command '%s' failed with exit code %d" % (command, r) )
201198

202199

203-
def install_module_dependencies( deps, x, gm, git_args, dep_path ):
200+
def install_module_dependencies( deps, x, gm, git_args ):
204201

205202
modules = []
206203

@@ -217,18 +214,11 @@ def install_module_dependencies( deps, x, gm, git_args, dep_path ):
217214
install_modules( modules, git_args )
218215

219216
for m in modules:
220-
next_dep_path = dep_path[:]
221-
if dep_path:
222-
next_dep_path.append(m)
223-
scan_module_dependencies( m, x, gm, deps, [ 'include', 'src' ], next_dep_path )
217+
scan_module_dependencies( m, x, gm, deps, [ 'include', 'src' ] )
224218

225219
return len( modules )
226220

227221

228-
class DependencyCycle(Exception):
229-
pass
230-
231-
232222
if( __name__ == "__main__" ):
233223

234224
parser = argparse.ArgumentParser( description='Installs the dependencies needed to test a Boost library.' )
@@ -240,7 +230,6 @@ class DependencyCycle(Exception):
240230
parser.add_argument( '-I', '--include', help="additional subdirectory to scan; can be repeated", metavar='DIR', action='append', default=[] )
241231
parser.add_argument( '-g', '--git_args', help="additional arguments to `git submodule update`", default='', action='store' )
242232
parser.add_argument( '-u', '--update', help='update <library> before scanning', action='store_true' )
243-
parser.add_argument( '-C', '--reject-cycles', help='abort if <library> has cyclical dependencies', action='store_true' )
244233
parser.add_argument( 'library', help="name of library to scan ('libs/' will be prepended)" )
245234

246235
args = parser.parse_args()
@@ -250,7 +239,6 @@ class DependencyCycle(Exception):
250239
vprint( 2, '-X:', args.exclude )
251240
vprint( 2, '-I:', args.include )
252241
vprint( 2, '-N:', args.ignore )
253-
vprint( 2, '-C:', args.reject_cycles )
254242

255243
x = read_exceptions()
256244
vprint( 2, 'Exceptions:', x )
@@ -281,11 +269,7 @@ class DependencyCycle(Exception):
281269

282270
vprint( 1, 'Directories to scan:', *dirs )
283271

284-
dep_path = []
285-
if args.reject_cycles:
286-
dep_path.append(m)
287-
288-
scan_module_dependencies( m, x, gm, deps, dirs, dep_path )
272+
scan_module_dependencies( m, x, gm, deps, dirs )
289273

290274
for dep in args.ignore:
291275
if dep in deps:
@@ -294,5 +278,5 @@ class DependencyCycle(Exception):
294278

295279
vprint( 2, 'Dependencies:', deps )
296280

297-
while install_module_dependencies( deps, x, gm, args.git_args, dep_path ):
281+
while install_module_dependencies( deps, x, gm, args.git_args ):
298282
pass

0 commit comments

Comments
 (0)