parameters: (location = None, arch = None, version = None, threading = None,
          exceptions = None, revision = None, log = EmptyLogger())
return_statement: return root_dir
docstring: Returns the root folder of a specific version of the mingw-builds variant
      of gcc. Will download the compiler if needed
docstring_summary: Returns the root folder of a specific version of the mingw-builds variant
      of gcc. Will download the compiler if needed
docstring_tokens: Returns the root folder of a specific version of the mingw - builds variant of gcc . Will download the compiler if needed
function: def root(location = None, arch = None, version = None, threading = None,
          exceptions = None, revision = None, log = EmptyLogger()):
      '''
      Returns the root folder of a specific version of the mingw-builds variant
      of gcc. Will download the compiler if needed
      '''
  
      # Get the repository if we don't have all the information
      if not (arch and version and threading and exceptions and revision):
          versions = repository(log = log)
  
      # Determine some defaults
      version = version or max(versions.keys())
      if not arch:
          arch = platform.machine().lower()
          if arch == 'x86':
              arch = 'i686'
          elif arch == 'amd64':
              arch = 'x86_64'
      if not threading:
          keys = versions[version][arch].keys()
          if 'posix' in keys:
              threading = 'posix'
          elif 'win32' in keys:
              threading = 'win32'
          else:
              threading = keys[0]
      if not exceptions:
          keys = versions[version][arch][threading].keys()
          if 'seh' in keys:
              exceptions = 'seh'
          elif 'sjlj' in keys:
              exceptions = 'sjlj'
          else:
              exceptions = keys[0]
      if revision == None:
          revision = max(versions[version][arch][threading][exceptions].keys())
      if not location:
          location = os.path.join(tempfile.gettempdir(), 'mingw-builds')
  
      # Get the download url
      url = versions[version][arch][threading][exceptions][revision]
  
      # Tell the user whatzzup
      log.info('finding MinGW %s', '.'.join(str(v) for v in version))
      log.debug(' - arch: %s', arch)
      log.debug(' - threading: %s', threading)
      log.debug(' - exceptions: %s', exceptions)
      log.debug(' - revision: %s', revision)
      log.debug(' - url: %s', url)
  
      # Store each specific revision differently
      slug = '{version}-{arch}-{threading}-{exceptions}-rev{revision}'
      slug = slug.format(
          version = '.'.join(str(v) for v in version),
          arch = arch,
          threading = threading,
          exceptions = exceptions,
          revision = revision
      )
      if arch == 'x86_64':
          root_dir = os.path.join(location, slug, 'mingw64')
      elif arch == 'i686':
          root_dir = os.path.join(location, slug, 'mingw32')
      else:
          raise ValueError('Unknown MinGW arch: ' + arch)
  
      # Download if needed
      if not os.path.exists(root_dir):
          downloaded = download(url, os.path.join(location, slug), log = log)
          if downloaded != root_dir:
              raise ValueError('The location of mingw did not match\n%s\n%s'
                  % (downloaded, root_dir))
  
      return root_dir
function_tokens: def root ( location = None , arch = None , version = None , threading = None , exceptions = None , revision = None , log = EmptyLogger ( ) ) : # Get the repository if we don't have all the information if not ( arch and version and threading and exceptions and revision ) : versions = repository ( log = log ) # Determine some defaults version = version or max ( versions . keys ( ) ) if not arch : arch = platform . machine ( ) . lower ( ) if arch == 'x86' : arch = 'i686' elif arch == 'amd64' : arch = 'x86_64' if not threading : keys = versions [ version ] [ arch ] . keys ( ) if 'posix' in keys : threading = 'posix' elif 'win32' in keys : threading = 'win32' else : threading = keys [ 0 ] if not exceptions : keys = versions [ version ] [ arch ] [ threading ] . keys ( ) if 'seh' in keys : exceptions = 'seh' elif 'sjlj' in keys : exceptions = 'sjlj' else : exceptions = keys [ 0 ] if revision == None : revision = max ( versions [ version ] [ arch ] [ threading ] [ exceptions ] . keys ( ) ) if not location : location = os . path . join ( tempfile . gettempdir ( ) , 'mingw-builds' ) # Get the download url url = versions [ version ] [ arch ] [ threading ] [ exceptions ] [ revision ] # Tell the user whatzzup log . info ( 'finding MinGW %s' , '.' . join ( str ( v ) for v in version ) ) log . debug ( ' - arch: %s' , arch ) log . debug ( ' - threading: %s' , threading ) log . debug ( ' - exceptions: %s' , exceptions ) log . debug ( ' - revision: %s' , revision ) log . debug ( ' - url: %s' , url ) # Store each specific revision differently slug = '{version}-{arch}-{threading}-{exceptions}-rev{revision}' slug = slug . format ( version = '.' . join ( str ( v ) for v in version ) , arch = arch , threading = threading , exceptions = exceptions , revision = revision ) if arch == 'x86_64' : root_dir = os . path . join ( location , slug , 'mingw64' ) elif arch == 'i686' : root_dir = os . path . join ( location , slug , 'mingw32' ) else : raise ValueError ( 'Unknown MinGW arch: ' + arch ) # Download if needed if not os . path . exists ( root_dir ) : downloaded = download ( url , os . path . join ( location , slug ) , log = log ) if downloaded != root_dir : raise ValueError ( 'The location of mingw did not match\n%s\n%s' % ( downloaded , root_dir ) ) return root_dir