File: vcmakeall.py

package info (click to toggle)
egenix-mx-base 2.0.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,028 kB
  • ctags: 4,762
  • sloc: ansic: 14,965; python: 11,739; sh: 313; makefile: 117
file content (53 lines) | stat: -rw-r--r-- 1,763 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/local/bin/python

""" Helper script to path the VC generated Makefile and execute
    NMAKE.

    Copyright (c) 2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2004, eGenix.com Software GmbH; mailto:info@egenix.com
    See the documentation for further copyright information or contact
    the author.

"""

import sys,os,imp

def makeall(configuration='Release',target='',dir='.'):

    # Find directories with vcmake.py and execute the script
    entries = os.listdir(dir)
    for entry in entries:
        if os.path.isdir(entry):
            subdir = os.path.join(dir,entry)
            vcmakefile = os.path.join(subdir,'vcmake.py')
            if os.path.isfile(vcmakefile):
                print 'entering',subdir
                print ' importing',vcmakefile
                try:
                    vcmake = imp.load_source('vcmake',
                                             vcmakefile,
                                             open(vcmakefile,'rb'))
                except:
                    print ' XXX Error %s:%s' % sys.exc_info()[:2]
                    continue
                print ' running vcmake.make()'
                print '-'*72
                origdir = os.getcwd()
                os.chdir(subdir)
                try:
                    vcmake.make(entry,configuration,target)
                except:
                    print ' XXX Error %s:%s' % sys.exc_info()[:2]
                os.chdir(origdir)
                print '-'*72

if __name__ == '__main__':
    try:
        apply(makeall,tuple(sys.argv[1:]))
    except TypeError:
        print "vcmakeall.py <configuration> [<maketarget>] [<dir>]"
        print
        print "Example: vcmakeall.py Release"
        print
        sys.exit(1)