|
|
|
@ -46,13 +46,18 @@ class Qemu(BaseManager):
|
|
|
|
|
:returns: List of folders where Qemu binaries MAY reside.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
paths = []
|
|
|
|
|
=======
|
|
|
|
|
qemus = []
|
|
|
|
|
paths = set()
|
|
|
|
|
>>>>>>> master
|
|
|
|
|
try:
|
|
|
|
|
paths.append(os.getcwd())
|
|
|
|
|
paths.add(os.getcwd())
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
log.warning("The current working directory doesn't exist")
|
|
|
|
|
if "PATH" in os.environ:
|
|
|
|
|
paths.extend(os.environ["PATH"].split(os.pathsep))
|
|
|
|
|
paths.update(os.environ["PATH"].split(os.pathsep))
|
|
|
|
|
else:
|
|
|
|
|
log.warning("The PATH environment variable doesn't exist")
|
|
|
|
|
# look for Qemu binaries in the current working directory and $PATH
|
|
|
|
@ -63,20 +68,25 @@ class Qemu(BaseManager):
|
|
|
|
|
exec_dir = os.path.dirname(os.path.abspath(sys.executable))
|
|
|
|
|
for f in os.listdir(exec_dir):
|
|
|
|
|
if f.lower().startswith("qemu"):
|
|
|
|
|
paths.append(os.path.join(exec_dir, f))
|
|
|
|
|
paths.add(os.path.join(exec_dir, f))
|
|
|
|
|
|
|
|
|
|
if "PROGRAMFILES(X86)" in os.environ and os.path.exists(os.environ["PROGRAMFILES(X86)"]):
|
|
|
|
|
paths.append(os.path.join(os.environ["PROGRAMFILES(X86)"], "qemu"))
|
|
|
|
|
paths.add(os.path.join(os.environ["PROGRAMFILES(X86)"], "qemu"))
|
|
|
|
|
if "PROGRAMFILES" in os.environ and os.path.exists(os.environ["PROGRAMFILES"]):
|
|
|
|
|
paths.append(os.path.join(os.environ["PROGRAMFILES"], "qemu"))
|
|
|
|
|
paths.add(os.path.join(os.environ["PROGRAMFILES"], "qemu"))
|
|
|
|
|
elif sys.platform.startswith("darwin"):
|
|
|
|
|
# add specific locations on Mac OS X regardless of what's in $PATH
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
paths.extend(["/usr/bin", "/usr/local/bin", "/opt/local/bin"])
|
|
|
|
|
=======
|
|
|
|
|
paths.update(["/usr/local/bin", "/opt/local/bin"])
|
|
|
|
|
>>>>>>> master
|
|
|
|
|
if hasattr(sys, "frozen"):
|
|
|
|
|
try:
|
|
|
|
|
paths.append(os.path.abspath(os.path.join(os.getcwd(), "../../../qemu/bin/")))
|
|
|
|
|
paths.add(os.path.abspath(os.path.join(os.getcwd(), "../../../qemu/bin/")))
|
|
|
|
|
# If the user run the server by hand from outside
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
paths.append(["/Applications/GNS3.app/Contents/Resources/qemu/bin"])
|
|
|
|
|
return paths
|
|
|
|
|
|
|
|
|
@ -90,6 +100,10 @@ class Qemu(BaseManager):
|
|
|
|
|
|
|
|
|
|
qemus = []
|
|
|
|
|
for path in Qemu.paths_list():
|
|
|
|
|
=======
|
|
|
|
|
paths.add("/Applications/GNS3.app/Contents/Resources/qemu/bin")
|
|
|
|
|
for path in paths:
|
|
|
|
|
>>>>>>> master
|
|
|
|
|
try:
|
|
|
|
|
for f in os.listdir(path):
|
|
|
|
|
if (f.startswith("qemu-system") or f.startswith("qemu-kvm") or f == "qemu" or f == "qemu.exe") and \
|
|
|
|
|