File: mingw32distutils.py

package info (click to toggle)
pygame 1.9.4.post1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,412 kB
  • sloc: ansic: 54,632; python: 28,791; objc: 334; php: 92; sh: 76; makefile: 36; cpp: 25
file content (37 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (4)
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
# module mingw32distutils.py
# Requires Python 2.1 or better.

"""Enhance distutils mingw32 compilation by adding Win32 GUI/console support."""

from distutils import ccompiler
from distutils.errors import DistutilsModuleError

compilers = ['mingw32', 'mingw32-console']

# Add the compiler classes to the ccompiler table. Unfortunate hacks follow.

compiler_class = ccompiler.compiler_class
value = compiler_class['mingw32']
assert len(value) == 3, "distutils.ccompiler.compiler_class has changed"
compiler_class['mingw32'] = ('', '',
                             value[2] + ", Win32 GUI shared libraries defaullt")
compiler_class['mingw32-console'] = ('', '',
                                     value[2] + ", console shared libraries")

original_new_compiler = ccompiler.new_compiler
def new_compiler (plat=None,
                  compiler=None,
                  verbose=0,
                  dry_run=0,
                  force=0):
    """Recognizes replacement mingw32 compiler classes"""

    if compiler == 'mingw32':
        from mingw32ccompiler import Mingw32DefaultCCompiler
        return Mingw32DefaultCCompiler (None, dry_run, force)
    if compiler == 'mingw32-console':
        from mingw32ccompiler import Mingw32ConsoleCCompiler
        return Mingw32ConsoleCCompiler (None, dry_run, force)
    return original_new_compiler (plat, compiler, verbose, dry_run, force)

ccompiler.new_compiler = new_compiler