summaryrefslogtreecommitdiff
path: root/cad/src/experimental/oleksandr/distutils_compile_options.py
blob: 3a7e9156e3fb5088caae61ec1675483d44139dc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright 2006-2007 Nanorex, Inc.  See LICENSE file for details. 
import sys
import distutils.sysconfig
import distutils.ccompiler

class FakeCompiler:
    def __init__(self):
        self.compiler_type = distutils.ccompiler.get_default_compiler()
    def set_executables(self, **kw):
        for k in kw: setattr(self, k, kw[k])

mcc = FakeCompiler()
distutils.sysconfig.customize_compiler(mcc)

if len(sys.argv) < 2:
    import pprint
    pprint.pprint(mcc.__dict__)
else:
    for arg in sys.argv[1:]:
        cmd = getattr(mcc, arg)
        if cmd.startswith("gcc ") or cmd.startswith("g++ "):
            cmd = cmd[4:]
        print cmd