~ubuntu-branches/ubuntu/trusty/xiphos/trusty

« back to all changes in this revision

Viewing changes to wafadmin/Tools/gnu_dirs.py

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs, Dmitrijs Ledkovs
  • Date: 2012-03-11 18:43:32 UTC
  • mfrom: (17.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120311184332-splq3ecpx7tyi87d
Tags: 3.1.5+dfsg-1
[ Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> ]  
* New upstream release.
* Build using webkit backend
* Contains unpacked source for waf binary (Closes: #654511)
* Update debian/copyright to latest specification

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
# encoding: utf-8
 
3
 
 
4
import Utils,Options
 
5
_options=[x.split(', ')for x in'''
 
6
bindir, user executables, ${EXEC_PREFIX}/bin
 
7
sbindir, system admin executables, ${EXEC_PREFIX}/sbin
 
8
libexecdir, program executables, ${EXEC_PREFIX}/libexec
 
9
sysconfdir, read-only single-machine data, ${PREFIX}/etc
 
10
sharedstatedir, modifiable architecture-independent data, ${PREFIX}/com
 
11
localstatedir, modifiable single-machine data, ${PREFIX}/var
 
12
libdir, object code libraries, ${EXEC_PREFIX}/lib
 
13
includedir, C header files, ${PREFIX}/include
 
14
oldincludedir, C header files for non-gcc, /usr/include
 
15
datarootdir, read-only arch.-independent data root, ${PREFIX}/share
 
16
datadir, read-only architecture-independent data, ${DATAROOTDIR}
 
17
infodir, info documentation, ${DATAROOTDIR}/info
 
18
localedir, locale-dependent data, ${DATAROOTDIR}/locale
 
19
mandir, man documentation, ${DATAROOTDIR}/man
 
20
docdir, documentation root, ${DATAROOTDIR}/doc/${PACKAGE}
 
21
htmldir, html documentation, ${DOCDIR}
 
22
dvidir, dvi documentation, ${DOCDIR}
 
23
pdfdir, pdf documentation, ${DOCDIR}
 
24
psdir, ps documentation, ${DOCDIR}
 
25
'''.split('\n')if x]
 
26
def detect(conf):
 
27
        def get_param(varname,default):
 
28
                return getattr(Options.options,varname,'')or default
 
29
        env=conf.env
 
30
        env['EXEC_PREFIX']=get_param('EXEC_PREFIX',env['PREFIX'])
 
31
        env['PACKAGE']=Utils.g_module.APPNAME
 
32
        complete=False
 
33
        iter=0
 
34
        while not complete and iter<len(_options)+1:
 
35
                iter+=1
 
36
                complete=True
 
37
                for name,help,default in _options:
 
38
                        name=name.upper()
 
39
                        if not env[name]:
 
40
                                try:
 
41
                                        env[name]=Utils.subst_vars(get_param(name,default),env)
 
42
                                except TypeError:
 
43
                                        complete=False
 
44
        if not complete:
 
45
                lst=[name for name,_,_ in _options if not env[name.upper()]]
 
46
                raise Utils.WafError('Variable substitution failure %r'%lst)
 
47
def set_options(opt):
 
48
        inst_dir=opt.add_option_group('Installation directories','By default, "waf install" will put the files in\
 
49
 "/usr/local/bin", "/usr/local/lib" etc. An installation prefix other\
 
50
 than "/usr/local" can be given using "--prefix", for example "--prefix=$HOME"')
 
51
        for k in('--prefix','--destdir'):
 
52
                option=opt.parser.get_option(k)
 
53
                if option:
 
54
                        opt.parser.remove_option(k)
 
55
                        inst_dir.add_option(option)
 
56
        inst_dir.add_option('--exec-prefix',help='installation prefix [Default: ${PREFIX}]',default='',dest='EXEC_PREFIX')
 
57
        dirs_options=opt.add_option_group('Pre-defined installation directories','')
 
58
        for name,help,default in _options:
 
59
                option_name='--'+name
 
60
                str_default=default
 
61
                str_help='%s [Default: %s]'%(help,str_default)
 
62
                dirs_options.add_option(option_name,help=str_help,default='',dest=name.upper())
 
63