]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/distutils/command/build.py
   1 """distutils.command.build 
   3 Implements the Distutils 'build' command.""" 
   5 # This module should be kept compatible with Python 1.5.2. 
  10 from distutils
.core 
import Command
 
  11 from distutils
.util 
import get_platform
 
  14 def show_compilers (): 
  15     from distutils
.ccompiler 
import show_compilers
 
  19 class build (Command
): 
  21     description 
= "build everything needed to install" 
  25          "base directory for build library"), 
  26         ('build-purelib=', None, 
  27          "build directory for platform-neutral distributions"), 
  28         ('build-platlib=', None, 
  29          "build directory for platform-specific distributions"), 
  31          "build directory for all distribution (defaults to either " + 
  32          "build-purelib or build-platlib"), 
  33         ('build-scripts=', None, 
  34          "build directory for scripts"), 
  36          "temporary build directory"), 
  38          "specify the compiler type"), 
  40          "compile extensions and libraries with debugging information"), 
  42          "forcibly build everything (ignore file timestamps)"), 
  45     boolean_options 
= ['debug', 'force'] 
  48         ('help-compiler', None, 
  49          "list available compilers", show_compilers
), 
  52     def initialize_options (self
): 
  53         self
.build_base 
= 'build' 
  54         # these are decided only after 'build_base' has its final value 
  55         # (unless overridden by the user or client) 
  56         self
.build_purelib 
= None 
  57         self
.build_platlib 
= None 
  59         self
.build_temp 
= None 
  60         self
.build_scripts 
= None 
  65     def finalize_options (self
): 
  67         plat_specifier 
= ".%s-%s" % (get_platform(), sys
.version
[0:3]) 
  69         # 'build_purelib' and 'build_platlib' just default to 'lib' and 
  70         # 'lib.<plat>' under the base build directory.  We only use one of 
  71         # them for a given distribution, though -- 
  72         if self
.build_purelib 
is None: 
  73             self
.build_purelib 
= os
.path
.join(self
.build_base
, 'lib') 
  74         if self
.build_platlib 
is None: 
  75             self
.build_platlib 
= os
.path
.join(self
.build_base
, 
  76                                               'lib' + plat_specifier
) 
  78         # 'build_lib' is the actual directory that we will use for this 
  79         # particular module distribution -- if user didn't supply it, pick 
  80         # one of 'build_purelib' or 'build_platlib'. 
  81         if self
.build_lib 
is None: 
  82             if self
.distribution
.ext_modules
: 
  83                 self
.build_lib 
= self
.build_platlib
 
  85                 self
.build_lib 
= self
.build_purelib
 
  87         # 'build_temp' -- temporary directory for compiler turds, 
  89         if self
.build_temp 
is None: 
  90             self
.build_temp 
= os
.path
.join(self
.build_base
, 
  91                                            'temp' + plat_specifier
) 
  92         if self
.build_scripts 
is None: 
  93             self
.build_scripts 
= os
.path
.join(self
.build_base
, 
  94                                               'scripts-' + sys
.version
[0:3]) 
 101         # Run all relevant sub-commands.  This will be some subset of: 
 102         #  - build_py      - pure Python modules 
 103         #  - build_clib    - standalone C libraries 
 104         #  - build_ext     - Python extensions 
 105         #  - build_scripts - (Python) scripts 
 106         for cmd_name 
in self
.get_sub_commands(): 
 107             self
.run_command(cmd_name
) 
 110     # -- Predicates for the sub-command list --------------------------- 
 112     def has_pure_modules (self
): 
 113         return self
.distribution
.has_pure_modules() 
 115     def has_c_libraries (self
): 
 116         return self
.distribution
.has_c_libraries() 
 118     def has_ext_modules (self
): 
 119         return self
.distribution
.has_ext_modules() 
 121     def has_scripts (self
): 
 122         return self
.distribution
.has_scripts() 
 125     sub_commands 
= [('build_py',      has_pure_modules
), 
 126                     ('build_clib',    has_c_libraries
), 
 127                     ('build_ext',     has_ext_modules
), 
 128                     ('build_scripts', has_scripts
),