Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(10)  |  Derive(0)  |  Import(0)
takes the externals string from svn and make a dictionary from it 

        def parse_externals(repo, mode='svn'):
    """ takes the externals string from svn and make a dictionary from it """

    strings = get_externals(repo, mode)

    # check if the mode is sane
    if mode not in modes:
        raise NotImplementedError('mode %s not implemented' % mode)

    externals = []
    
    # for mode = 'cvs'
    root = None

    for i in strings:
        i = i.split('#', 1)[0].strip() # remove comments

        # pass on empty strings
        if not i: 
            continue        

        # parse the root if in cvs mode
        if mode == 'cvs' and i.startswith('CVSROOT='):
           root = i.split('=',1)[1]
           continue

        j = i.split()

        # note: these will be the same for .tgz files
        name = j[0]
        repo = j[len(j) - 1]

        version = None
        if len(j[1:-1]):
            version = j[-2]
            version = version.split('r')[-1]

        externals.append({'name': name,
                          'revision': version,
                          'repository': repo})

        if mode == 'cvs':
            externals[-1]['root'] = root
        
    return externals
        


src/e/x/externalator-0.7.0/externalator/tests/tests.py   externalator(Download)
              (svn_external_name, svn_external), checkout_name)
 
externals = externalator.parse_externals(checkout_name, 'svn')
assert len(externals) == 1
assert externals[0]['repository'] == svn_external
    assert i in dirlisting
 
externals = externalator.parse_externals(testdir, 'svn')
assert len(externals) == 1
assert externals[0]['repository'] == svn_external
assert svn_external in get
 
externals = externalator.parse_externals(testdir, 'cvs')
assert len(externals) == 1
assert externals[0]['repository'] == cvs_external
    assert i in dirlisting
 
externals = externalator.parse_externals(checkout_name, 'svn')
assert len(externals) == 1
assert externals[0]['repository'] == svn_external
 
externals = externalator.parse_externals(checkout_name, 'cvs')