Beispiel #1
0
    def show_python_lib_info(self, plibs, header=1, verb=2):
        if header: print UTIL.section_divider('python libs', hchar='-')
        for lib in plibs:
            MT.test_import(lib, verb=verb)
        # explicitly note whether we have PyQt4
        if not MT.test_import('PyQt4', verb=0):
            self.have_pyqt4 = 1

            # check for partial install
            cmd = 'from PyQt4 import QtCore, QtGui'
            try:
                exec cmd
            except:
                print '\n** have PyQt4, but cannot load QtCore, QtGui; error is:' \
                      '\n\n'                                                      \
                      '   **************************************************'
                os.system('python -c "%s"' % cmd)
                print '   **************************************************\n'
                self.comments.append('check for partial install of PyQt4')
        print

        pdirs = glob.glob('/sw/bin/python*')
        if len(pdirs) > 0:
            pdirs = [dd for dd in pdirs if dd.find('config') < 0]
        if len(pdirs) > 0:
            print 'python binaries under /sw/bin:'
            for pdir in pdirs:
                if os.path.islink(pdir):
                    rstr = ' (sym link to %s)' % os.path.realpath(pdir)
                else:
                    rstr = ''
                print '    %-20s%s' % (pdir, rstr)
            print
Beispiel #2
0
   def show_python_lib_info(self, plibs, header=1, verb=2):
      if header: print UTIL.section_divider('python libs', hchar='-')
      for lib in plibs: MT.test_import(lib, verb=verb)
      # explicitly note whether we have PyQt4
      if not MT.test_import('PyQt4', verb=0):
         self.have_pyqt4 = 1

         # check for partial install
         cmd = 'from PyQt4 import QtCore, QtGui'
         try: exec cmd
         except:
            print '\n** have PyQt4, but cannot load QtCore, QtGui; error is:' \
Beispiel #3
0
   def show_python_lib_info(self, plibs, header=1, verb=2):
      if header: print UTIL.section_divider('python libs', hchar='-')
      for lib in plibs: MT.test_import(lib, verb=verb)
      print

      pdirs = glob.glob('/sw/bin/python*')
      if len(pdirs) > 0: pdirs = [dd for dd in pdirs if dd.find('config')<0]
      if len(pdirs) > 0:
         print 'python binaries under /sw/bin:'
         for pdir in pdirs:
            if os.path.islink(pdir):
               rstr = ' (sym link to %s)' % os.path.realpath(pdir)
            else: rstr = ''
            print '    %-20s%s' % (pdir, rstr)
         print
Beispiel #4
0
    def test_python_lib_pyqt4(self, verb=2):
        # actual lib test
        libname = 'PyQt4'
        rv = MT.simple_import_test(libname, verb=verb)

        # if failure, no biggie for now
        if rv:
            print('-- %s is no longer needed for an AFNI bootcamp' % libname)
            return 1

        # it loads, but how about QtCore and QtGui
        if not MT.test_import(libname, verb=0):
            self.have_pyqt4 = 1

            # but check for partial install
            cmd = 'from PyQt4 import QtCore, QtGui'
            try:
                exec(cmd)
            except:
                print('\n** have PyQt4, but cannot load QtCore, QtGui; error is:' \
                      '\n\n'                                                      \
                      '   **************************************************')
                os.system('python -c "%s"' % cmd)
                print(
                    '   **************************************************\n')
                self.comments.append('check for partial install of PyQt4')
                self.have_pyqt4 = 0

                return 1

        return 0
Beispiel #5
0
    def show_python_lib_info(self, plibs, header=1, verb=2):
        if header: print UTIL.section_divider('python libs', hchar='-')
        for lib in plibs:
            MT.test_import(lib, verb=verb)
        print

        pdirs = glob.glob('/sw/bin/python*')
        if len(pdirs) > 0:
            pdirs = [dd for dd in pdirs if dd.find('config') < 0]
        if len(pdirs) > 0:
            print 'python binaries under /sw/bin:'
            for pdir in pdirs:
                if os.path.islink(pdir):
                    rstr = ' (sym link to %s)' % os.path.realpath(pdir)
                else:
                    rstr = ''
                print '    %-20s%s' % (pdir, rstr)
            print
Beispiel #6
0
 def show_spec_mac(self):
    """look for fink, macports, homebrew"""
    # if no pyqt4, check for brew and fink packages
    if MT.test_import('PyQt4', verb=0):
       glist = glob.glob('/usr/local/lib/python2*/site-packages/PyQt4')
       if len(glist) == 0:
          glist = glob.glob('/sw/lib/qt4*/lib/python2*/site-packages/PyQt4')
       if len(glist) > 0:
          gdir = glist[-1]
          ghead = os.path.dirname(gdir)
          print '++ found PyQt4 under %s' % ghead
          print '   (consider adding %s to PYTHONPATH)' % ghead
Beispiel #7
0
 def show_spec_mac(self):
     """look for fink, macports, homebrew"""
     # if no pyqt4, check for brew and fink packages
     if MT.test_import('PyQt4', verb=0):
         glist = glob.glob('/usr/local/lib/python2*/site-packages/PyQt4')
         if len(glist) == 0:
             glist = glob.glob(
                 '/sw/lib/qt4*/lib/python2*/site-packages/PyQt4')
         if len(glist) > 0:
             gdir = glist[-1]
             ghead = os.path.dirname(gdir)
             print '++ found PyQt4 under %s' % ghead
             print '   (consider adding %s to PYTHONPATH)' % ghead