Statistics
| Branch: | Tag: | Revision:

mininet / util / versioncheck.py @ master

History | View | Annotate | Download (666 Bytes)

1
#!/usr/bin/python
2

    
3
from subprocess import check_output as co
4
from sys import exit
5

    
6
# Actually run bin/mn rather than importing via python path
7
version = 'Mininet ' + co( 'PYTHONPATH=. bin/mn --version', shell=True )
8
version = version.strip()
9

    
10
# Find all Mininet path references
11
lines = co( "egrep -or 'Mininet [0-9\.\+]+\w*' *", shell=True )
12

    
13
error = False
14

    
15
for line in lines.split( '\n' ):
16
    if line and 'Binary' not in line:
17
        fname, fversion = line.split( ':' )
18
        if version != fversion:
19
            print "%s: incorrect version '%s' (should be '%s')" % (
20
                fname, fversion, version )
21
            error = True
22

    
23
if error:
24
    exit( 1 )