File tree Expand file tree Collapse file tree 8 files changed +71
-2
lines changed Expand file tree Collapse file tree 8 files changed +71
-2
lines changed Original file line number Diff line number Diff line change
1
+ /root/.mininet-venv
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
3
import os
4
+
5
+ # Activate virtual environment if a venv path has been specified in .venv
6
+ # This must be executed only if this file has been executed as a
7
+ # script (instead of a module)
8
+ if __name__ == '__main__' :
9
+ # Check if .venv file exists
10
+ if os .path .exists ('.venv' ):
11
+ with open ('.venv' , 'r' ) as venv_file :
12
+ # Get virtualenv path from .venv file
13
+ venv_path = venv_file .read ()
14
+ # Get path of the activation script
15
+ venv_path = os .path .join (venv_path , 'bin/activate_this.py' )
16
+ if not os .path .exists (venv_path ):
17
+ print ('Virtual environment path specified in .venv '
18
+ 'points to an invalid path\n ' )
19
+ exit (- 2 )
20
+ with open (venv_path ) as f :
21
+ # Read the activation script
22
+ code = compile (f .read (), venv_path , 'exec' )
23
+ # Execute the activation script to activate the venv
24
+ exec (code , {'__file__' : venv_path })
25
+
4
26
import shutil
5
27
from mininet .topo import Topo
6
28
from mininet .node import Host
Original file line number Diff line number Diff line change 2
2
3
3
import os
4
4
5
- # Activate virtual environment
5
+ # Activate virtual environment if a venv path has been specified in .venv
6
6
# This must be executed only if this file has been executed as a
7
7
# script (instead of a module)
8
8
if __name__ == '__main__' :
Original file line number Diff line number Diff line change 2
2
3
3
import os
4
4
5
- # Activate virtual environment
5
+ # Activate virtual environment if a venv path has been specified in .venv
6
6
# This must be executed only if this file has been executed as a
7
7
# script (instead of a module)
8
8
if __name__ == '__main__' :
Original file line number Diff line number Diff line change
1
+ /root/.mininet-venv
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
3
import os
4
+
5
+ # Activate virtual environment if a venv path has been specified in .venv
6
+ # This must be executed only if this file has been executed as a
7
+ # script (instead of a module)
8
+ if __name__ == '__main__' :
9
+ # Check if .venv file exists
10
+ if os .path .exists ('.venv' ):
11
+ with open ('.venv' , 'r' ) as venv_file :
12
+ # Get virtualenv path from .venv file
13
+ venv_path = venv_file .read ()
14
+ # Get path of the activation script
15
+ venv_path = os .path .join (venv_path , 'bin/activate_this.py' )
16
+ if not os .path .exists (venv_path ):
17
+ print ('Virtual environment path specified in .venv '
18
+ 'points to an invalid path\n ' )
19
+ exit (- 2 )
20
+ with open (venv_path ) as f :
21
+ # Read the activation script
22
+ code = compile (f .read (), venv_path , 'exec' )
23
+ # Execute the activation script to activate the venv
24
+ exec (code , {'__file__' : venv_path })
25
+
4
26
import shutil
5
27
from mininet .topo import Topo
6
28
from mininet .node import Host
Original file line number Diff line number Diff line change
1
+ /root/.mininet-venv
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/python
2
2
3
3
import os
4
+
5
+ # Activate virtual environment if a venv path has been specified in .venv
6
+ # This must be executed only if this file has been executed as a
7
+ # script (instead of a module)
8
+ if __name__ == '__main__' :
9
+ # Check if .venv file exists
10
+ if os .path .exists ('.venv' ):
11
+ with open ('.venv' , 'r' ) as venv_file :
12
+ # Get virtualenv path from .venv file
13
+ venv_path = venv_file .read ()
14
+ # Get path of the activation script
15
+ venv_path = os .path .join (venv_path , 'bin/activate_this.py' )
16
+ if not os .path .exists (venv_path ):
17
+ print ('Virtual environment path specified in .venv '
18
+ 'points to an invalid path\n ' )
19
+ exit (- 2 )
20
+ with open (venv_path ) as f :
21
+ # Read the activation script
22
+ code = compile (f .read (), venv_path , 'exec' )
23
+ # Execute the activation script to activate the venv
24
+ exec (code , {'__file__' : venv_path })
25
+
4
26
import shutil
5
27
from mininet .topo import Topo
6
28
from mininet .node import Host
You can’t perform that action at this time.
0 commit comments