

def do_vcs_install(manifest_in, versionfile_source, ipy):
    GITS = ['git']
    if (sys.platform == 'win32'):
        GITS = ['git.cmd', 'git.exe']
    files = [manifest_in, versionfile_source]
    if ipy:
        files.append(ipy)
    try:
        me = __file__
        if (me.endswith('.pyc') or me.endswith('.pyo')):
            me = (os.path.splitext(me)[0] + '.py')
        versioneer_file = os.path.relpath(me)
    except NameError:
        versioneer_file = 'versioneer.py'
    files.append(versioneer_file)
    present = False
    try:
        f = open('.gitattributes', 'r')
        for line in f.readlines():
            if line.strip().startswith(versionfile_source):
                if ('export-subst' in line.strip().split()[1:]):
                    present = True
        f.close()
    except EnvironmentError:
        pass
    if (not present):
        f = open('.gitattributes', 'a+')
        f.write(('%s export-subst\n' % versionfile_source))
        f.close()
        files.append('.gitattributes')
    run_command(GITS, (['add', '--'] + files))

dataset/ETHPy150Open Anaconda-Platform/chalmers/versioneer.py do_vcs_install/original