File: SConstruct

package info (click to toggle)
kdissert 0.3.8-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,580 kB
  • ctags: 876
  • sloc: cpp: 9,132; python: 519; sh: 52; makefile: 25
file content (100 lines) | stat: -rw-r--r-- 3,139 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# scons script for building kdissert (top-level directory)
# Thomas Nagy, 2004 <tnagy2^8@yahoo.fr>

import os

env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde'], toolpath=['./'])

#env['HOME'] = os.environ['HOME']
# TODO : remove
env.AppendUnique( ENV = os.environ )

## The target make dist requires the python module shutil which is in 2.3
env.EnsurePythonVersion(2, 3)

## Bksys requires scons 0.96
env.EnsureSConsVersion(0, 96)

Export( "env" )

# Cache directory
env.CacheDir('cache')

# Avoid spreading .sconsign files everywhere
env.SConsignFile('signatures')

### we are not using rcs or sccs, avoid scanning
### especially if on network file systems
paths = [ '.', './src', './src/templates', './src/kdissert', './src/kdissert/datastruct',
    './src/kdissert/canvasview', './src/kdissert/treelistview',
    './src/kdissert/generator', './src/kdissert/gui', './src/kdissert/shell' ]
for dir in paths:
    env.SourceCode( dir, None )

### another assume foo.moc is always included foo.cpp files (make sure no file is forgetted)
env['NOMOCSCAN'] = True

#KDEaddpaths(paths, env)

### important, the name of our app
env['APPNAME'] = 'kdissert'

### important, export the environment
Export("env")

### subdirectories
SConscript("src/kdissert/SConscript")
SConscript("src/templates/SConscript")
SConscript("doc/SConscript")
SConscript("po/SConscript")
SConscript("src/appdata/SConscript")
SConscript("src/pics/SConscript")

### to make a tarball of your masterpiece
if 'dist' in COMMAND_LINE_TARGETS:

    APPNAME = 'kdissert'
    VERSION = os.popen("cat VERSION").read().rstrip()
    FOLDER  = APPNAME+'-'+VERSION
    ARCHIVE = FOLDER+'.tar.bz2'

    def tarball(env, target, source):
        """
        Function called to make a tarball of the sources
        Make sure to have python 2.3 for the shutil module
        """
        import shutil
        import glob

        ## check if the temporary directory already exists
        if os.path.isdir(FOLDER):
           shutil.rmtree(FOLDER)

        ## create a temporary directory
        startdir = os.getcwd()
        shutil.copytree(startdir, FOLDER)

        ## remove the unnecessary files
        os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf")
        os.popen("find "+FOLDER+" -name \".arch-ids\" | xargs rm -rf")
        os.popen("find "+FOLDER+" -name \".arch-inventory\" | xargs rm -f")
        os.popen("find "+FOLDER+" -name \"sconsign*\" | xargs rm -f")
        os.popen("find "+FOLDER+" -name \"*cache*\" | xargs rm -rf")
	os.popen("find "+FOLDER+" -name \"kdiss*-data\" | xargs rm -rf")
	os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f")
        os.popen("rm -f "+FOLDER+"/config.py*")

        ## make the tarball
        os.popen("tar cjf "+ARCHIVE+" "+FOLDER)

        ## remove the temporary directory
        if os.path.isdir(FOLDER):
            shutil.rmtree(FOLDER)

    ## Make an alias so that 'scons dist' builds the archive
    env.Command(ARCHIVE, 'VERSION', tarball)
    env.Alias('dist', ARCHIVE )

    ## Tell scons to rebuild the archive everytime
    env.AlwaysBuild(ARCHIVE)