root/trunk/setup.py

Revision 3633, 3.9 kB (checked in by dmeyer, 3 months ago)

enable recursive doc build

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date Author
Line 
1# -*- coding: iso-8859-1 -*-
2# -----------------------------------------------------------------------------
3# setup.py - Setup script for kaa
4# -----------------------------------------------------------------------------
5# $Id$
6#
7# -----------------------------------------------------------------------------
8# kaa - Kaa Media Repository
9# Copyright (C) 2005 Dirk Meyer, Jason Tackaberry
10#
11# First Edition: Dirk Meyer <dmeyer@tzi.de>
12# Maintainer:    Dirk Meyer <dmeyer@tzi.de>
13#
14# This program is free software; you can redistribute it and/or modify
15# it under the terms of the GNU General Public License as published by
16# the Free Software Foundation; either version 2 of the License, or
17# (at your option) any later version.
18#
19# This program is distributed in the hope that it will be useful, but
20# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
21# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
22# Public License for more details.
23#
24# You should have received a copy of the GNU General Public License along
25# with this program; if not, write to the Free Software Foundation, Inc.,
26# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#
28# -----------------------------------------------------------------------------
29
30import os
31import sys
32import distutils.core
33
34submodules = [ 'base', 'imlib2', 'display', 'mevas', 'epg',
35               'metadata', 'xine', 'cherrypy', 'beacon', 'popcorn',
36               'feedmanager' ]
37
38# We require python 2.4 or later, so complain if that isn't satisfied.
39if sys.version.split()[0] < '2.4':
40    print "Python 2.4 or later required."
41    sys.exit(1)
42
43for a in sys.argv:
44    if a.startswith('--help'):
45        distutils.core.setup(name="kaa", version="0.1")
46        sys.exit(0)
47
48# if no arguments, or --help* requested, return errormessage from core
49if len(sys.argv) == 1:
50    distutils.core.setup(name="kaa", version="0.1")
51    sys.exit(0)
52
53if len(sys.argv) == 2 and sys.argv[1] == 'clean':
54    for m in submodules:
55        for file in ('build', 'dist', 'src/version.py', 'MANIFEST'):
56            if m == 'base' and file == 'src/version.py':
57                continue
58            file = os.path.join(m, file)
59            if os.path.isdir(file):
60                print 'removing %s' % file
61                os.system('rm -rf %s' % file)
62            if os.path.isfile(file):
63                print 'removing %s' % file
64                os.unlink(file)
65           
66elif len(sys.argv) == 2 and sys.argv[1] == 'doc':
67    if not os.path.isdir('doc/html'):
68        os.makedirs('doc/html')
69    for m in submodules:
70        if os.path.isfile('%s/doc/Makefile' % m):
71            print '[setup] Entering kaa submodule', m
72            os.chdir(m)
73            try:
74                execfile('setup.py')
75            except SystemExit:
76                print 'failed to create doc for', m
77            os.chdir('..')
78            if not os.path.exists('doc/html/%s' % m):
79                os.symlink('../../%s/doc/html' % m, 'doc/html/%s' % m)
80            print '[setup] Leaving kaa submodule', m
81    os.chdir('doc')
82    os.system('make html')
83else:
84    failed = []
85    build = []
86    for m in submodules:
87        print '[setup] Entering kaa submodule', m
88        os.chdir(m)
89        try:
90            execfile('setup.py')
91        except SystemExit:
92            print 'failed to build', m
93            failed.append(m)
94            if m == 'base':
95                sys.exit(1)
96        else:
97            build.append(m)
98        os.chdir('..')
99        print '[setup] Leaving kaa submodule', m
100
101        if m == 'base':
102            # Adding base/build/lib to the python path so that all kaa modules
103            # can find the distribution file of kaa.base
104            for subdir in os.listdir('base/build'):
105                if not subdir.startswith('lib'):
106                    continue
107                sys.path.insert(0, '../base/build/%s' % subdir)
108
109    print
110    print 'Summary:'
111    print '+', ', '.join(build)
112    print '-', ', '.join(failed)
Note: See TracBrowser for help on using the browser.