imp = warning
    imp += '#import "' + outputBasename + '.h"\n\n'
    imp += '\n\n'.join(lines[1])

    headerFn = os.path.join(outputDir, outputBasename + '.h')
    impFn = os.path.join(outputDir, outputBasename + '.m')

    with open(headerFn, 'w') as f:
        f.write(header.encode('utf-8'))

    with open(impFn, 'w') as f:
        f.write(imp.encode('utf-8'))

if __name__ == '__main__':
    outBasename = 'AssetCatalogIdentifiers'
    prefix = lib.classPrefix

    projectDir = os.path.join(lib.getEnv('SRCROOT'), lib.getEnv('PROJECT_NAME'))

    catalogDirs = list(lib.recursiveGlob(projectDir, '*.xcassets', includeDirs = True))
    lines = ([], [])
    for catalogDir in catalogDirs:
        hString, mString = headerAndImpContentsForCatalog(catalogDir, prefix)
        if hString:
            lines[0].append(hString)
            lines[1].append(mString)

    outDir = os.path.join(projectDir, 'Other-Sources', 'Generated')
    assembleAndOutput(lines, outDir, outBasename)

    print 'Generated {}.h and .m for image assets in the following catalog(s): {}'.format(outBasename, ', '.join([os.path.basename(d) for d in catalogDirs]))
Beispiel #2
0
    with open(headerFn, 'w') as f:
        f.write(header.encode('utf-8'))

    with open(impFn, 'w') as f:
        f.write(imp.encode('utf-8'))


if __name__ == '__main__':
    outBasename = 'AssetCatalogIdentifiers'
    prefix = lib.classPrefix

    projectDir = os.path.join(lib.getEnv('SRCROOT'),
                              lib.getEnv('PROJECT_NAME'))

    catalogDirs = list(
        lib.recursiveGlob(projectDir, '*.xcassets', includeDirs=True))
    lines = ([], [])
    for catalogDir in catalogDirs:
        hString, mString = headerAndImpContentsForCatalog(catalogDir, prefix)
        if hString:
            lines[0].append(hString)
            lines[1].append(mString)

    outDir = os.path.join(projectDir, 'Other-Sources', 'Generated')
    assembleAndOutput(lines, outDir, outBasename)

    print(
        'Generated {}.h and .m for image assets in the following catalog(s): {}'
        .format(outBasename,
                ', '.join([os.path.basename(d) for d in catalogDirs])))
    with open(headerFn, 'w') as f:
        f.write(header.encode('utf-8'))

    with open(impFn, 'w') as f:
        f.write(imp.encode('utf-8'))


if __name__ == '__main__':
    outBasename = 'StoryboardIdentifiers'
    prefix = lib.classPrefix
    needRestorationIDs = 'NEED_RESTORATION_IDS' in os.environ

    projectDir = os.path.join(lib.getEnv('SRCROOT'), lib.getEnv('PROJECT_NAME'))

    inputFiles = list(lib.recursiveGlob(projectDir, '*.storyboard'))

    lines = ([], [])
    for fn in inputFiles:
        idList = IDList.fromFile(fn, prefix, needRestorationIDs)
        hString, mString = idList.headerAndImpContents()
        if hString:
            lines[0].append('#pragma mark ' + idList.name)
            lines[0].append(hString)

            lines[1].append('#pragma mark ' + idList.name)
            lines[1].append(mString)

    outDir = os.path.join(projectDir, 'Other-Sources', 'Generated')
    assembleAndOutput(lines, outDir, outBasename)
    with open(headerFn, 'w') as f:
        f.write(header.encode('utf-8'))

    with open(impFn, 'w') as f:
        f.write(imp.encode('utf-8'))


if __name__ == '__main__':
    outBasename = 'StoryboardIdentifiers'
    prefix = lib.classPrefix
    needRestorationIDs = 'NEED_RESTORATION_IDS' in os.environ

    projectDir = os.path.join(lib.getEnv('SRCROOT'),
                              lib.getEnv('PROJECT_NAME'))

    inputFiles = list(lib.recursiveGlob(projectDir, '*.storyboard'))

    lines = ([], [])
    for fn in inputFiles:
        idList = IDList.fromFile(fn, prefix, needRestorationIDs)
        hString, mString = idList.headerAndImpContents()
        if hString:
            lines[0].append('#pragma mark ' + idList.name)
            lines[0].append(hString)

            lines[1].append('#pragma mark ' + idList.name)
            lines[1].append(mString)

    outDir = os.path.join(projectDir, 'Other-Sources', 'Generated')
    assembleAndOutput(lines, outDir, outBasename)