Update and rename MantenerFIFO to MantenerFIFO.md
[vsorcdistro/.git] / mininet / util / versioncheck.py
1 #!/usr/bin/python
2
3 from subprocess import check_output as co
4 from sys import exit, version_info
5
6 def run(*args, **kwargs):
7     "Run co and decode for python3"
8     result = co(*args, **kwargs)
9     return result.decode() if version_info[ 0 ] >= 3 else result
10
11 # Actually run bin/mn rather than importing via python path
12 version = 'Mininet ' + run( 'PYTHONPATH=. bin/mn --version 2>&1', shell=True )
13 version = version.strip()
14
15 # Find all Mininet path references
16 lines = run( "egrep -or 'Mininet [0-9\.\+]+\w*' *", shell=True )
17
18 error = False
19
20 for line in lines.split( '\n' ):
21     if line and 'Binary' not in line:
22         fname, fversion = line.split( ':' )
23         if version != fversion:
24             print( "%s: incorrect version '%s' (should be '%s')" % (
25                 fname, fversion, version ) )
26             error = True
27
28 if error:
29     exit( 1 )