Skip to content

Commit 4ec94c3

Browse files
authored
Merge pull request #18 from netgroup/fix-virtualenv
Fix virtual environment issues
2 parents 2d025a6 + 0a84e78 commit 4ec94c3

File tree

13 files changed

+1
-138
lines changed

13 files changed

+1
-138
lines changed

nets/3routers/.venv

Lines changed: 0 additions & 1 deletion
This file was deleted.

nets/3routers/ospf3r.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@
22

33
import os
44

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-
# and remove trailing newline chars
14-
venv_path = venv_file.read().rstrip()
15-
# Get path of the activation script
16-
venv_path = os.path.join(venv_path, 'bin/activate_this.py')
17-
if not os.path.exists(venv_path):
18-
print('Virtual environment path specified in .venv '
19-
'points to an invalid path\n')
20-
exit(-2)
21-
with open(venv_path) as f:
22-
# Read the activation script
23-
code = compile(f.read(), venv_path, 'exec')
24-
# Execute the activation script to activate the venv
25-
exec(code, {'__file__': venv_path})
26-
275
import shutil
286
from mininet.topo import Topo
297
from mininet.node import Host

nets/8r-1c-in-band-isis/.venv

Lines changed: 0 additions & 1 deletion
This file was deleted.

nets/8r-1c-in-band-isis/isis8d.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@
22

33
import os
44

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-
# and remove trailing newline chars
14-
venv_path = venv_file.read().rstrip()
15-
# Get path of the activation script
16-
venv_path = os.path.join(venv_path, 'bin/activate_this.py')
17-
if not os.path.exists(venv_path):
18-
print('Virtual environment path specified in .venv '
19-
'points to an invalid path\n')
20-
exit(-2)
21-
with open(venv_path) as f:
22-
# Read the activation script
23-
code = compile(f.read(), venv_path, 'exec')
24-
# Execute the activation script to activate the venv
25-
exec(code, {'__file__': venv_path})
26-
275
from argparse import ArgumentParser
286
import python_hosts
297
import shutil

nets/8r-1c-out-band-isis/.venv

Lines changed: 0 additions & 1 deletion
This file was deleted.

nets/8r-1c-out-band-isis/isis8d.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@
22

33
import os
44

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-
# and remove trailing newline chars
14-
venv_path = venv_file.read().rstrip()
15-
# Get path of the activation script
16-
venv_path = os.path.join(venv_path, 'bin/activate_this.py')
17-
if not os.path.exists(venv_path):
18-
print('Virtual environment path specified in .venv '
19-
'points to an invalid path\n')
20-
exit(-2)
21-
with open(venv_path) as f:
22-
# Read the activation script
23-
code = compile(f.read(), venv_path, 'exec')
24-
# Execute the activation script to activate the venv
25-
exec(code, {'__file__': venv_path})
26-
275
from argparse import ArgumentParser
286
import python_hosts
297
import shutil

nets/8r-1c-srv6-pm/.venv

Lines changed: 0 additions & 1 deletion
This file was deleted.

nets/8r-1c-srv6-pm/isis8d.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@
22

33
import os
44

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-
# and remove trailing newline chars
14-
venv_path = venv_file.read().rstrip()
15-
# Get path of the activation script
16-
venv_path = os.path.join(venv_path, 'bin/activate_this.py')
17-
if not os.path.exists(venv_path):
18-
print('Virtual environment path specified in .venv '
19-
'points to an invalid path\n')
20-
exit(-2)
21-
with open(venv_path) as f:
22-
# Read the activation script
23-
code = compile(f.read(), venv_path, 'exec')
24-
# Execute the activation script to activate the venv
25-
exec(code, {'__file__': venv_path})
26-
275
from argparse import ArgumentParser
286
import python_hosts
297
import shutil

nets/8routers-isis-ipv6/.venv

Lines changed: 0 additions & 1 deletion
This file was deleted.

nets/8routers-isis-ipv6/isis8d.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@
22

33
import os
44

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-
# and remove trailing newline chars
14-
venv_path = venv_file.read().rstrip()
15-
# Get path of the activation script
16-
venv_path = os.path.join(venv_path, 'bin/activate_this.py')
17-
if not os.path.exists(venv_path):
18-
print('Virtual environment path specified in .venv '
19-
'points to an invalid path\n')
20-
exit(-2)
21-
with open(venv_path) as f:
22-
# Read the activation script
23-
code = compile(f.read(), venv_path, 'exec')
24-
# Execute the activation script to activate the venv
25-
exec(code, {'__file__': venv_path})
26-
275
from argparse import ArgumentParser
286
import python_hosts
297
import shutil

0 commit comments

Comments
 (0)