chiark / gitweb /
Use an alternative method to check for wxPython if distutils is not available
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Mon, 16 Nov 2015 22:51:10 +0000 (17:51 -0500)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Mon, 16 Nov 2015 22:51:10 +0000 (17:51 -0500)
Cura/gui/app.py

index 4aade3335391f00d9d114c33e1f81151b7852ba1..d3fa61a998b47774227174ee72a35bacacb580c5 100644 (file)
@@ -114,14 +114,23 @@ class CuraApp(wx.App):
                from Cura.util import profile
                from Cura.util import resources
                from Cura.util import version
-               from distutils.version import LooseVersion
 
                resources.setupLocalization(profile.getPreference('language'))  # it's important to set up localization at very beginning to install _
 
-               if LooseVersion(wx.__version__) < LooseVersion('3.0'):
-                       wx.MessageBox(_("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s.") % wx.__version__,
-                                                 _("WxPython version is too old"), wx.OK | wx.ICON_ERROR)
-                       return
+               try:
+                       from distutils.version import LooseVersion
+
+                       if LooseVersion(wx.__version__) < LooseVersion('3.0'):
+                               wx.MessageBox(_("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s.") % wx.__version__,
+                                                         _("WxPython version is too old"), wx.OK | wx.ICON_ERROR)
+                               return
+               except:
+                       # distutils not found.. it can happen!
+                       # Only check the first 3 characters of the version string instead
+                       if float(wx.__version__[0:3]) < 3.0:
+                               wx.MessageBox(_("This version of Cura requires WxPython version 3.0 or newer.\nYour current WxPython version is %s.") % wx.__version__,
+                                                         _("WxPython version is too old"), wx.OK | wx.ICON_ERROR)
+                               return
 
                #If we do not have preferences yet, try to load it from a previous Cura install
                if profile.getMachineSetting('machine_type') == 'unknown':