X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22d08289596acb73ca3f1af4d3ced0a43a9051e8..60df0f96859fb0131ddfa8b477612a15f4a43790:/wxPython/my_distutils.py?ds=inline diff --git a/wxPython/my_distutils.py b/wxPython/my_distutils.py index 84edd6b547..12b4e6d09a 100644 --- a/wxPython/my_distutils.py +++ b/wxPython/my_distutils.py @@ -14,6 +14,24 @@ from distutils.ccompiler import \ class MyMSVCCompiler(MSVCCompiler): +## def __init__ (self, +## verbose=0, +## dry_run=0, +## force=0): +## MSVCCompiler.__init__(self, verbose, dry_run, force) + +## self.compile_options = [ '/nologo', +## '/Ox', +## '/MD', +## '/W3', +## '/GX', +## ] +## self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GX', +## '/Z7', '/D_DEBUG'] + + + + ##------------------------------------------------------------ ## Override the entire compile method just to add flags to the ## RC command. There should be an easier way to do this from @@ -54,15 +72,15 @@ class MyMSVCCompiler(MSVCCompiler): self.mkpath (os.path.dirname (obj)) if ext in self._c_extensions: - input_opt = "/Tc" + os.path.abspath(src) + input_opt = "/Tc" + os.path.abspath(src) ### RPD elif ext in self._cpp_extensions: - input_opt = "/Tp" + os.path.abspath(src) + input_opt = "/Tp" + os.path.abspath(src) ### RPD elif ext in self._rc_extensions: # compile .RC to .RES file input_opt = src output_opt = "/fo" + obj try: - self.spawn ([self.rc] + pp_opts + ### RPD changed this line only + self.spawn ([self.rc] + pp_opts + ### RPD changed this line [output_opt] + [input_opt]) except DistutilsExecError, msg: raise CompileError, msg @@ -349,7 +367,15 @@ class MyBCPPCompiler(BCPPCompiler): from distutils import ccompiler -ccompiler.default_compiler['nt'] = 'my_msvc' +if hasattr(ccompiler, "default_compiler"): + ccompiler.default_compiler['nt'] = 'my_msvc' +elif hasattr(ccompiler, "_default_compilers"): + lst = list(ccompiler._default_compilers) + lst.remove( ('nt', 'msvc') ) + lst.append( ('nt', 'my_msvc') ) + ccompiler._default_compilers = tuple(lst) + + ccompiler.compiler_class['my_msvc'] = ('my_distutils', 'MyMSVCCompiler', 'My MSVC derived class') @@ -364,6 +390,52 @@ import my_distutils sys.modules['distutils.my_distutils'] = my_distutils +#---------------------------------------------------------------------- +# More hacking... Distutils in Python 2.1 changed the strip_dir flag +# passed to object_filenames to true, which causes problems for us since +# there are a few duplicate source/object names between some of the +# extensions in wxPython. This hack replaces the CCompiler._prep_compile +# method with this one. + +from distutils.dep_util import newer_pairwise + +def _prep_compile (self, sources, output_dir): + """Determine the list of object files corresponding to 'sources', + and figure out which ones really need to be recompiled. Return a + list of all object files and a dictionary telling which source + files can be skipped. + """ + # Get the list of expected output (object) files + objects = self.object_filenames (sources, + strip_dir=0, + output_dir=output_dir) + + if self.force: + skip_source = {} # rebuild everything + for source in sources: + skip_source[source] = 0 + else: + # Figure out which source files we have to recompile according + # to a simplistic check -- we just compare the source and + # object file, no deep dependency checking involving header + # files. + skip_source = {} # rebuild everything + for source in sources: # no wait, rebuild nothing + skip_source[source] = 1 + + (n_sources, n_objects) = newer_pairwise (sources, objects) + for source in n_sources: # no really, only rebuild what's + skip_source[source] = 0 # out-of-date + + return (objects, skip_source) + +# _prep_compile () + +CCompiler._prep_compile = _prep_compile + + + + #---------------------------------------------------------------------- # Run SWIG the way I want it done