Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/olpcgames/buildmanifest.py
blob: 899433b03a3c3072ea702f02a904a3b92a303d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/env python
"""Stupid little script to automate generation of MANIFEST and po/POTFILES.in

Really this should have been handled by using distutils, but oh well,
distutils is a hoary beast and I can't fault people for not wanting to 
spend days spelunking around inside it to find the solutions...
"""
from distutils.filelist import FileList
import os

def fileList( template ):
    """Produce a formatted file-list for storing in a file"""
    files = FileList()
    for line in filter(None,template.splitlines()):
        files.process_template_line( line )
    content = '\n'.join( files.files )
    return content


def main( ):
    """Do the quicky finding of files for our manifests"""
    content = fileList( open('MANIFEST.in').read() )
    open( 'MANIFEST','w').write( content )
    
    content = fileList( open('POTFILES.in').read() )
    try:
        os.makedirs( 'po' )
    except OSError, err:
        pass
    open( os.path.join('po','POTFILES.in'), 'w').write( content )

if __name__ == "__main__":
    main()