Commit Graph

71 Commits

Author SHA1 Message Date
Martin v. Löwis de2cde614c Detect Win64 builds. 2006-02-20 12:26:58 +00:00
Martin v. Löwis e46af8c367 Let the SDK setup override distutils logic. 2006-02-20 12:15:15 +00:00
Martin v. Löwis b813c53cd8 Patch #827386: Support absolute source paths in msvccompiler.py.
Backported to 2.4.
2005-08-07 20:51:04 +00:00
Tim Peters a733bd96f1 Port bugfix from 2.4 maint.
Bug #1160802:  Can't build Zope on Windows w/ 2.4.1c1.

MSVCCompiler.initialize():  set self.initialized to True, as suggested
by AMK.  Else we keep growing the PATH endlessly, with each new C
extension built, until putenv() complains.

No change to NEWS because the patch that created this bug is also new
for 2.5a1 (so there's no change here to any code yet released from HEAD).
2005-03-12 19:05:58 +00:00
Brett Cannon 1bfd85b612 Remove some more tab usage to prevent an error when run as ``python -tt``. 2005-03-05 05:32:14 +00:00
Brett Cannon 3304a14148 Remove a tab so that whitespace usage is consistent. 2005-03-05 05:28:45 +00:00
Martin v. Löwis c72dd38f30 Patch #1075887: Don't require MSVC in distutils if there is nothing
to build. Will backport to 2.4
2005-03-04 13:50:17 +00:00
Tim Peters 26be2067e8 Whitespace normalization. 2004-11-28 01:10:01 +00:00
Fredrik Lundh cb328f393e SF patch #1071739 (by Christos Georgiou)
This patch offers a better explanation in case the MS VC++ (free)
toolkit is installed but the .NET Framework SDK is not.
2004-11-24 22:31:11 +00:00
Martin v. Löwis 5a6601cfc6 Update compatibility comments to 2.1, corresponding to PEP 291 1.13. 2004-11-10 22:23:15 +00:00
Thomas Heller 41f7038a3e Avoid a linker warning: MSVC 7 doesn't support /pdb:None, the debug
info will always be in a .pdb file.
2004-11-10 09:01:41 +00:00
Tim Peters 182b5aca27 Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
Thomas Heller 9436a75e4d Compile the files in the same order they are passed to the compiler.
Use case: Sometimes 'compiling' source files (with SWIG, for example)
creates additionl files which included by later sources.  The win32all
setup script requires this.

There is no SF item for this, but it was discussed on distutils-sig:
http://mail.python.org/pipermail/distutils-sig/2003-November/003514.html
2003-12-05 20:12:23 +00:00
Thomas Heller b310591169 See SF #848614: distutils' msvccompiler now tries to detect that MSVC6
is installed but the registry settings are incomplete because the gui
has never been run.

Already backported to release23-maint.
2003-11-28 19:42:56 +00:00
Jeremy Hylton e9a92aa03a Patch from John Anderson to enable VC 7.1 support.
I tested against VC 7.0 and it caused no problems there.
2003-07-17 14:41:07 +00:00
Marc-André Lemburg f0b5d174c1 Restore Python 1.5.2 compatibility. 2003-05-14 19:48:57 +00:00
Jeremy Hylton 93724dbd3d Replace line somehow deleted before last checkin. 2003-05-09 16:55:28 +00:00
Jeremy Hylton 9ddf6c3803 Variant of SF patch 614770: MSVC 7 support
distutils now looks for the compiler version in sys.version, falling
back to MSVC 6 if the version isn't listed (Python 2.2 and lower).
Add helper routines for reading the registry.  Refactor many
module functions into methods of the compiler to avoid passing
lots of state as arguments.
2003-05-09 16:06:42 +00:00
Thomas Heller 9582794c17 Pass the preprocessor options also to the resource compiler
when compiling .RC files.

From Robin Dunn, fixes SF # 669198.
2003-01-31 20:40:15 +00:00
Andrew M. Kuchling d448f66317 Add comment to Distutil files about requiring 1.5.2 compatibility, as
suggested by PEP 291.
2002-11-19 13:12:28 +00:00
Andrew M. Kuchling a6483d2e9a Remove 'created by' lines; people can use CVS for this, and the information is often out of date 2002-11-14 02:25:42 +00:00
Gustavo Niemeyer 6b016852f8 This patch fixes the following bugs:
[#413582] g++ must be called for c++ extensions
[#454030] distutils cannot link C++ code with GCC

topdir = "Lib/distutils"

* bcppcompiler.py
  (BCPPCompiler.create_static_lib): Fixed prototype, removing extra_preargs
  and extra_postargs parameters. Included target_lang parameter.
  (BCPPCompiler.link): Included target_lang parameter.

* msvccompiler.py
  (MSVCCompiler.create_static_lib): Fixed prototype, removing extra_preargs
  and extra_postargs parameters. Included target_lang parameter.
  (MSVCCompiler.link): Included target_lang parameter.

* ccompiler.py
  (CCompiler): New language_map and language_order attributes, used by
  CCompiler.detect_language().

  (CCompiler.detect_language): New method, will return the language of
  a given source, or list of sources. Individual source language is
  detected using the language_map dict. When mixed sources are used,
  language_order will stablish the language precedence.

  (CCompiler.create_static_lib, CCompiler.link, CCompiler.link_executable,
   CCompiler.link_shared_object, CCompiler.link_shared_lib):
  Inlcuded target_lang parameter.

* cygwinccompiler.py
  (CygwinCCompiler.link): Included target_lang parameter.

* emxccompiler.py
  (EMXCCompiler.link): Included target_lang parameter.

* mwerkscompiler.py
  (MWerksCompiler.link): Included target_lang parameter.

* extension.py
  (Extension.__init__): New 'language' parameter/attribute, initialized
  to None by default. If provided will overlap the automatic detection
  made by CCompiler.detect_language(), in build_ext command.

* sysconfig.py
  (customize_compiler): Check Makefile for CXX option, and also the
  environment variable CXX. Use the resulting value in the 'compiler_cxx'
  parameter of compiler.set_executables().

* unixccompiler.py
  (UnixCCompiler): Included 'compiler_cxx' in executables dict, defaulting
  to 'cc'.
  (UnixCCompiler.create_static_lib): Included target_lang parameter.
  (UnixCCompiler.link): Included target_lang parameter, and made
  linker command use compiler_cxx, if target_lang is 'c++'.

* command/build_ext.py
  (build_ext.build_extension): Pass new ext.language attribute
  to compiler.link_shared_object()'s target_lang parameter. If
  ext.language is not provided, detect language using
  compiler.detect_language(sources) instead.

* command/config.py
  (config._link): Pass already available lang parameter as target_lang
  parameter of compiler.link_executable().
2002-11-05 16:12:02 +00:00
Jeremy Hylton 2683ac755d Define NDEBUG for releae builds, just like Python.
XXX Why doesn't distutils on Windows use the same set of flags as Python?
2002-06-18 19:08:40 +00:00
Jeremy Hylton 1bba31d9a2 Refactor compile() method implementations.
Always use _setup_compile() to do the grunt work of processing
arguments, figuring out which files to compile, and emitting debug
messages for files that are up-to-date.

Use _get_cc_args() when possible.
2002-06-13 17:28:18 +00:00
Jeremy Hylton cd8a1148e1 Make setup.py less chatty by default.
This is a conservative version of SF patch 504889.  It uses the log
module instead of calling print in various places, and it ignores the
verbose argument passed to many functions and set as an attribute on
some objects.  Instead, it uses the verbosity set on the logger via
the command line.

The log module is now preferred over announce() and warn() methods
that exist only for backwards compatibility.

XXX This checkin changes a lot of modules that have no test suite and
aren't exercised by the Python build process.  It will need
substantial testing.
2002-06-04 20:14:43 +00:00
Thomas Heller 69d31b749d Pass the full pathname to MSVC when compiling a debug version. This
allows the debugger to find the source without asking the user to
browse for it.
2002-04-25 17:29:45 +00:00
Thomas Heller 745b4609cb Make it 1.5.2 compatible again. 2002-02-08 14:41:31 +00:00
Martin v. Löwis 9635d0bd1f Encode MSVC paths as mbcs. Fixes #509117. 2.2.1 candidate. 2002-01-29 10:23:42 +00:00
Fred Drake b94b849d65 Whitespace normalization. 2001-12-06 20:51:35 +00:00
Greg Ward 4240648a9d Big patch from Rene Liebscher to simplify the CCompiler API and
implementations.  Details:
  * replace 'link_shared_object()', 'link_shared_lib()', and
    'link_executable()' with 'link()', which is (roughly)
    the union of the three methods it replaces
  * in all implementation classes (UnixCCompiler, MSVCCompiler, etc.),
    ditch the old 'link_*()' methods and replace them with 'link()'
  * in the abstract base class (CCompiler), add the old 'link_*()'
    methods as wrappers around the new 'link()' (they also print
    a warning of the deprecated interface)

Also increases consistency between MSVCCompiler and BCPPCompiler,
hopefully to make it easier to factor out the mythical WindowsCCompiler
class.  Details:
  * use 'self.linker' instead of 'self.link'
  * add ability to compile resource files to BCPPCompiler
  * added (redundant?) 'object_filename()' method to BCPPCompiler
  * only generate a .def file if 'export_symbols' defined
2000-09-27 02:08:14 +00:00
Greg Ward 9c0ea13ece *Very* belated application of Thomas Heller's patch to handle
resource files.  The gist of the patch is to treat ".rc" and ".mc"
files as source files; ".mc" files are compiled to ".rc" and then
".res", and ".rc" files are compiled to ".res".  Wish I knew what
all these things stood for...
2000-09-19 23:56:43 +00:00
Greg Ward 8a98cd9e25 Add /GX to 'compile_options'. This is definitely needed for C++ source;
according to the MS docs it enables exception-handling, and (according
to Alex Martelli <aleaxit@yahoo.com>) is needed to compile without
getting warnings from standard C++ library headers.  Apparently
it doesn't cause any problems with C code, so I haven't bothered
conditionalizing the use of /GX.
2000-08-31 00:31:07 +00:00
Greg Ward 408e9ae299 Add ".cxx" to the list of known C++ extensions. 2000-08-30 17:32:24 +00:00
Greg Ward d142564821 Added 'debug' flag to 'find_library_file()', and changed code to handle it. 2000-08-04 01:29:27 +00:00
Greg Ward 04c90fc475 Ditched some debugging prints. 2000-08-02 00:01:56 +00:00
Greg Ward 159eb92239 Patch from Rene Liebscher: generate an /IMPLIB: option to ensure that
the linker leaves the (temporary) .lib file in the temporary dir.  (Moved
from 'msvc_prelink_hack()' method in build_ext.py.)
2000-08-02 00:00:30 +00:00
Greg Ward 1b5ec76190 Simplify the registry-module-finding code: _winreg or win32api/win32con.
This'll work fine with 2.0 or 1.5.2, but is less than ideal for
1.6a1/a2.  But the code to accomodate 1.6a1/a2 was released with
Distutils 0.9, so it can go away now.
2000-06-30 19:37:59 +00:00
Greg Ward 83c3870e2b On second thought, first try for _winreg, and then winreg. Only if both
fail do we try for win32api/win32con.  If *those* both fail, then we don't
have registry access.  Phew!
2000-06-29 23:04:59 +00:00
Greg Ward cd079c4c28 Changed to use _winreg module instead of winreg. 2000-06-29 22:59:10 +00:00
Greg Ward bfc79d644a Lyle Johnson: added 'build_temp' parameter to 'link_shared_{lib,object}()'
methods (but not 'link_executable()', hmmm).  Currently only used by
BCPPCompiler; it's a dummy parameter for UnixCCompiler and MSVCCompiler.

Also added 'bcpp' to compiler table used by 'new_compiler()'.
2000-06-28 01:29:09 +00:00
Greg Ward 992c8f9dab Define the 'executables' class attribute so the CCompiler constructor
doesn't blow up.  We don't currently use the 'set_executables()' bureaucracy,
although it would be nice to do so for consistency with UnixCCompiler.
2000-06-25 02:31:16 +00:00
Greg Ward 3add77f611 Import exceptions from errors.py, not ccompiler.py. 2000-05-30 02:02:49 +00:00
Greg Ward d151711e66 Changed to catch compile/link failures and raise CompileError, LibError,
or LinkError (exception classes defined in ccompiler.py).
2000-05-30 01:56:44 +00:00
Greg Ward 5299b6afc5 Added support for the 'export_symbols' parameter to 'link_shared_object()'
and 'link_shared_lib()'.  In MSVCCompiler, this is meaningful: it adds
/EXPORT: options to the linker command line.  In UnixCCompiler, it
is ignored.
2000-05-20 13:23:21 +00:00
Greg Ward f70c603149 Added 'link_executable()' method (Berthold Hoellmann).
Two small fixes to 'link_shared_object()'.
2000-04-19 02:16:49 +00:00
Greg Ward 02a1a2b077 Cleaned up/simplified error-handling:
- DistutilsOptionError is now documented as it's actually used, ie.
    to indicate bogus option values (usually user options, eg. from
    the command-line)
  - added DistutilsSetupError to indicate errors that definitely arise
    in the setup script
  - got rid of DistutilsValueError, and changed all usage of it to
    either DistutilsSetupError or ValueError as appropriate
  - simplified a bunch of option get/set methods in Command and
    Distribution classes -- just pass on AttributeError most of
    the time, rather than turning it into something else
2000-04-15 22:15:07 +00:00
Greg Ward 19ce16665d Fixed my simplification to Thomas' patch: winreg and win32api export the same
functions, but with different names.
2000-03-31 19:04:25 +00:00
Greg Ward 1027e3fde9 Simplified Thomas Heller's registry patch: just assign all those
HKEY_* and Reg* names once, rather than having near-duplicate code
in the two import attempts.

Also dropped the leading underscore on all the imported symbols,
as it's not appropriate (they're not local to this module).
2000-03-31 16:53:42 +00:00
Greg Ward 7642f5cf38 Patch from Thomas Heller: use the new winreg module if available. 2000-03-31 16:47:40 +00:00
Greg Ward 95c0b269de Don't perpetrate the "_d" hack for naming debugging extensions -- that's
now done in the 'build_ext' command.
2000-03-31 03:52:16 +00:00