parameters: ()
docstring: Handle the validation of the PyQt license.
docstring_summary: Handle the validation of the PyQt license.
docstring_tokens: Handle the validation of the PyQt license .
function: def check_license():
      """Handle the validation of the PyQt license.
      """
      try:
          import license
          ltype = license.LicenseType
          lname = license.LicenseName
  
          try:
              lfile = license.LicenseFile
          except AttributeError:
              lfile = None
      except ImportError:
          ltype = None
  
      if ltype is None:
          ltype = "GPL"
          lname = "GNU General Public License"
          lfile = None
  
      sipconfig.inform("This is the %s version of PyQt %s (licensed under the %s) for Python %s on %s." % (ltype, pyqt_version_str, lname, sys.version.split()[0], sys.platform))
  
      # Common checks.
      if qt_licensee and ltype == "GPL":
          sipconfig.error("This version of PyQt and the commercial version of Qt have incompatible licenses.")
  
      # Confirm the license if not already done.
      if not opts.license_confirmed:
          if ltype == "GPL":
              loptions = """
  Type '2' to view the GPL v2 license.
  Type '3' to view the GPL v3 license.
  """
          else:
              loptions = """
  Type 'L' to view the license.
  """
  
          sys.stdout.write(loptions)
          sys.stdout.write("""Type 'yes' to accept the terms of the license.
  Type 'no' to decline the terms of the license.
  
  """)
  
          while 1:
              sys.stdout.write("Do you accept the terms of the license? ")
              sys.stdout.flush()
  
              try:
                  resp = sys.stdin.readline()
              except KeyboardInterrupt:
                  raise SystemExit
              except:
                  resp = ""
  
              resp = resp.strip().lower()
  
              if resp == "yes":
                  break
  
              if resp == "no":
                  sys.exit(0)
  
              if ltype == "GPL":
                  if resp == "2":
                      os.system("more LICENSE.GPL2")
                  elif resp == "3":
                      os.system("more LICENSE.GPL3")
              else:
                  if resp == "l":
                      os.system("more LICENSE")
  
      # If there should be a license file then check it is where it should be.
      if lfile:
          if os.access(os.path.join(src_dir, "sip", lfile), os.F_OK):
              sipconfig.inform("Found the license file %s." % lfile)
          else:
              sipconfig.error("Please copy the license file %s to the sip directory." % lfile)
function_tokens: def check_license ( ) : try : import license ltype = license . LicenseType lname = license . LicenseName try : lfile = license . LicenseFile except AttributeError : lfile = None except ImportError : ltype = None if ltype is None : ltype = "GPL" lname = "GNU General Public License" lfile = None sipconfig . inform ( "This is the %s version of PyQt %s (licensed under the %s) for Python %s on %s." % ( ltype , pyqt_version_str , lname , sys . version . split ( ) [ 0 ] , sys . platform ) ) # Common checks. if qt_licensee and ltype == "GPL" : sipconfig . error ( "This version of PyQt and the commercial version of Qt have incompatible licenses." ) # Confirm the license if not already done. if not opts . license_confirmed : if ltype == "GPL" : loptions = """
  Type '2' to view the GPL v2 license.
  Type '3' to view the GPL v3 license.
  """ else : loptions = """
  Type 'L' to view the license.
  """ sys . stdout . write ( loptions ) sys . stdout . write ( """Type 'yes' to accept the terms of the license.
  Type 'no' to decline the terms of the license.
  
  """ ) while 1 : sys . stdout . write ( "Do you accept the terms of the license? " ) sys . stdout . flush ( ) try : resp = sys . stdin . readline ( ) except KeyboardInterrupt : raise SystemExit except : resp = "" resp = resp . strip ( ) . lower ( ) if resp == "yes" : break if resp == "no" : sys . exit ( 0 ) if ltype == "GPL" : if resp == "2" : os . system ( "more LICENSE.GPL2" ) elif resp == "3" : os . system ( "more LICENSE.GPL3" ) else : if resp == "l" : os . system ( "more LICENSE" ) # If there should be a license file then check it is where it should be. if lfile : if os . access ( os . path . join ( src_dir , "sip" , lfile ) , os . F_OK ) : sipconfig . inform ( "Found the license file %s." % lfile ) else : sipconfig . error ( "Please copy the license file %s to the sip directory." % lfile )