File: build_ctools.py

package info (click to toggle)
obitools 1.2.13%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,652 kB
  • sloc: python: 18,199; ansic: 1,542; makefile: 98
file content (60 lines) | stat: -rw-r--r-- 1,730 bytes parent folder | download | duplicates (3)
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
'''
Created on 20 oct. 2012

@author: coissac
'''

import os


from obidistutils.command.build_exe import build_exe
from distutils.sysconfig import customize_compiler
from distutils.errors import DistutilsSetupError
from distutils import log

class build_ctools(build_exe):
    description = "build C/C++ executable not distributed with Python extensions"

    def initialize_options(self):
        build_exe.initialize_options(self)
        
        # List of built tools
        self.ctools = None
        self.littlebigman = None


    def finalize_options(self):
        # This might be confusing: both build-cexe and build-temp default
        # to build-temp as defined by the "build" command.  This is because
        # I think that C libraries are really just temporary build
        # by-products, at least from the point of view of building Python
        # extensions -- but I want to keep my options open.
            
        build_exe.finalize_options(self)
        
        
        self.set_undefined_options('build',
                                    ('build_temp', 'build_cexe'))

        self.set_undefined_options('littlebigman',
                                   ('littlebigman',  'littlebigman'))
                   
        self.executables = self.distribution.ctools
        self.check_executable_list(self.executables)
        
        if self.littlebigman =='-DLITTLE_END':
            if self.define is None:
                self.define=[('LITTLE_END',None)]
            else:
                self.define.append('LITTLE_END',None)

        self.ctools = set()

    def run(self):
        
        build_exe.run(self)
        for e,p in self.executables:
            self.ctools.add(e)