From 985c23a40eb56a324add1356f9697724b1f2237c Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 26 Feb 2015 19:31:18 -0700 Subject: [PATCH] Explicitly import handlers so freezing application can find and include the right modules. Do not import IOU on Windows to avoid importing unknown modules like fcntl on that platform. --- gns3server/handlers/__init__.py | 13 ++++++++++++- gns3server/handlers/api/__init__.py | 9 --------- gns3server/modules/__init__.py | 9 +++++++-- gns3server/server.py | 4 ++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/gns3server/handlers/__init__.py b/gns3server/handlers/__init__.py index 8d2587c9..c2247f30 100644 --- a/gns3server/handlers/__init__.py +++ b/gns3server/handlers/__init__.py @@ -14,5 +14,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from gns3server.handlers.api import * +import sys +from gns3server.handlers.api.version_handler import VersionHandler +from gns3server.handlers.api.network_handler import NetworkHandler +from gns3server.handlers.api.project_handler import ProjectHandler +from gns3server.handlers.api.dynamips_device_handler import DynamipsDeviceHandler +from gns3server.handlers.api.dynamips_vm_handler import DynamipsVMHandler +from gns3server.handlers.api.qemu_handler import QEMUHandler +from gns3server.handlers.api.virtualbox_handler import VirtualBoxHandler +from gns3server.handlers.api.vpcs_handler import VPCSHandler from gns3server.handlers.upload_handler import UploadHandler + +if sys.platform.startswith("linux"): + from gns3server.handlers.api.iou_handler import IOUHandler diff --git a/gns3server/handlers/api/__init__.py b/gns3server/handlers/api/__init__.py index 5d558245..e69de29b 100644 --- a/gns3server/handlers/api/__init__.py +++ b/gns3server/handlers/api/__init__.py @@ -1,9 +0,0 @@ -__all__ = ["version_handler", - "network_handler", - "vpcs_handler", - "project_handler", - "virtualbox_handler", - "dynamips_vm_handler", - "dynamips_device_handler", - "iou_handler", - "qemu_handler"] diff --git a/gns3server/modules/__init__.py b/gns3server/modules/__init__.py index 0f55e396..6b679996 100644 --- a/gns3server/modules/__init__.py +++ b/gns3server/modules/__init__.py @@ -15,10 +15,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys from .vpcs import VPCS from .virtualbox import VirtualBox from .dynamips import Dynamips -from .iou import IOU from .qemu import Qemu -MODULES = [VPCS, VirtualBox, Dynamips, IOU, Qemu] +MODULES = [VPCS, VirtualBox, Dynamips, Qemu] + +if sys.platform.startswith("linux"): + # IOU runs only on Linux + from .iou import IOU + MODULES.append(IOU) diff --git a/gns3server/server.py b/gns3server/server.py index 13b76f3d..406c0b3f 100644 --- a/gns3server/server.py +++ b/gns3server/server.py @@ -34,8 +34,8 @@ from .config import Config from .modules import MODULES from .modules.port_manager import PortManager -# TODO: get rid of * have something generic to automatically import handlers so the routes can be found -from gns3server.handlers import * +# do not delete this import +import gns3server.handlers import logging log = logging.getLogger(__name__)