setup.py
def fix_compile(remove_flags):
    """
    Monkey-patch compiler to allow for removal of default compiler flags.
    """
    import distutils.ccompiler

    def _fix_compile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0,
            extra_preargs=None, extra_postargs=None, depends=None):
        for flag in remove_flags:
            if flag in self.compiler_so:
                self.compiler_so.remove(flag)
        macros, objects, extra_postargs, pp_opts, build = self._setup_compile(output_dir, macros,
                include_dirs, sources, depends, extra_postargs)
        cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
        for obj in objects:
            try:
                src, ext = build[obj]
            except KeyError:
                continue
            self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        return objects

    distutils.ccompiler.CCompiler.compile = _fix_compile
def fix_compile(remove_flags):
    import distutils.ccompiler

    def _fix_compile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0,
            extra_preargs=None, extra_postargs=None, depends=None):
        for flag in remove_flags:
            if flag in self.compiler_so:
                self.compiler_so.remove(flag)
        macros, objects, extra_postargs, pp_opts, build = self._setup_compile(output_dir, macros,
                include_dirs, sources, depends, extra_postargs)
        cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
        for obj in objects:
            try:
                src, ext = build[obj]
            except KeyError:
                continue
            self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        return objects

    distutils.ccompiler.CCompiler.compile = _fix_compile
def fix_compile ( remove_flags ) : import distutils . ccompiler def _fix_compile ( self , sources , output_dir = None , macros = None , include_dirs = None , debug = 0 , extra_preargs = None , extra_postargs = None , depends = None ) : for flag in remove_flags : if flag in self . compiler_so : self . compiler_so . remove ( flag ) macros , objects , extra_postargs , pp_opts , build = self . _setup_compile ( output_dir , macros , include_dirs , sources , depends , extra_postargs ) cc_args = self . _get_cc_args ( pp_opts , debug , extra_preargs ) for obj in objects : try : src , ext = build [ obj ] except KeyError : continue self . _compile ( obj , src , ext , cc_args , extra_postargs , pp_opts ) return objects distutils . ccompiler . CCompiler . compile = _fix_compile
Monkey-patch compiler to allow for removal of default compiler flags.
Monkey - patch compiler to allow for removal of default compiler flags .