parameters: (urls = urls, log = EmptyLogger())
return_statement: return versions
docstring: Downloads and parse mingw-build repository files and parses them
docstring_summary: Downloads and parse mingw-build repository files and parses them
docstring_tokens: Downloads and parse mingw - build repository files and parses them
function: def repository(urls = urls, log = EmptyLogger()):
      '''
      Downloads and parse mingw-build repository files and parses them
      '''
      log.info('getting mingw-builds repository')
      versions = {}
      re_sourceforge = re.compile(r'http://sourceforge.net/projects/([^/]+)/files')
      re_sub = r'http://downloads.sourceforge.net/project/\1'
      for url in urls:
          log.debug(' - requesting: %s', url)
          socket = request.urlopen(url)
          repo = socket.read()
          if not isinstance(repo, str):
              repo = repo.decode();
          socket.close()
          for entry in repo.split('\n')[:-1]:
              value = entry.split('|')
              version = tuple([int(n) for n in value[0].strip().split('.')])
              version = versions.setdefault(version, {})
              arch = value[1].strip()
              if arch == 'x32':
                  arch = 'i686'
              elif arch == 'x64':
                  arch = 'x86_64'
              arch = version.setdefault(arch, {})
              threading = arch.setdefault(value[2].strip(), {})
              exceptions = threading.setdefault(value[3].strip(), {})
              revision = exceptions.setdefault(int(value[4].strip()[3:]),
                  re_sourceforge.sub(re_sub, value[5].strip()))
      return versions
function_tokens: def repository ( urls = urls , log = EmptyLogger ( ) ) : log . info ( 'getting mingw-builds repository' ) versions = { } re_sourceforge = re . compile ( r'http://sourceforge.net/projects/([^/]+)/files' ) re_sub = r'http://downloads.sourceforge.net/project/\1' for url in urls : log . debug ( ' - requesting: %s' , url ) socket = request . urlopen ( url ) repo = socket . read ( ) if not isinstance ( repo , str ) : repo = repo . decode ( ) socket . close ( ) for entry in repo . split ( '\n' ) [ : - 1 ] : value = entry . split ( '|' ) version = tuple ( [ int ( n ) for n in value [ 0 ] . strip ( ) . split ( '.' ) ] ) version = versions . setdefault ( version , { } ) arch = value [ 1 ] . strip ( ) if arch == 'x32' : arch = 'i686' elif arch == 'x64' : arch = 'x86_64' arch = version . setdefault ( arch , { } ) threading = arch . setdefault ( value [ 2 ] . strip ( ) , { } ) exceptions = threading . setdefault ( value [ 3 ] . strip ( ) , { } ) revision = exceptions . setdefault ( int ( value [ 4 ] . strip ( ) [ 3 : ] ) , re_sourceforge . sub ( re_sub , value [ 5 ] . strip ( ) ) ) return versions