Commit Graph

53 Commits

Author SHA1 Message Date
Jeremy Hylton a5f4c071b5 Remove use of string module and reflow a couple of long lines. 2002-11-05 20:11:08 +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
Andrew M. Kuchling 29c8623e5c [Patch #588809] LDFLAGS support for build_ext.py, from Robert Weber
customize_compiler() now looks at various environment variables and uses
   their values to override the configured C compiler/preprocessor/linker
   binary and flags.
2002-11-04 19:53:24 +00:00
Michael W. Hudson 6b7d69d9b4 Well, Fred never did explain why the code to determine whether the
calling Python was installed was so complicated, so I simplified it.

This should get the snake-farm's build scripts working again.
2002-07-12 09:16:44 +00:00
Neal Norwitz 80a3e0a604 Whitespace normalization (remove tabs) 2002-06-26 22:05:33 +00:00
Jack Jansen ab5320bfd9 Fixed various MacPython-specific issues found by attempting to use the standard core setup.py for MacPython. 2002-06-26 15:42:49 +00:00
Jeremy Hylton a2f9989c1a Fix unused local variables caught by pychecker.
Fixes a bug for Solaris pkgtool (bdist_pkgtool) that would have
prevented it from building subpackages.
2002-06-04 20:26:44 +00:00
Fred Drake 16c8d702a4 When using a Python that has not been installed to build 3rd-party
modules, distutils does not understand that the build version of the
source tree is needed.

This patch fixes distutils.sysconfig to understand that the running
Python is part of the build tree and needs to use the appropriate
"shape" of the tree. This does not assume anything about the current
directory, so can be used to build 3rd-party modules using Python's
build tree as well.

This is useful since it allows us to use a non-installed debug-mode
Python with 3rd-party modules for testing. It as the side-effect that
set_python_build() is no longer needed (the hack which was added to
allow distutils to be used to build the "standard" extension modules).

This closes SF patch #547734.
2002-06-04 15:28:21 +00:00
Marc-André Lemburg 2544f51036 OS/2 patches by Andrew I MacIntyre for distutils.
Closes patch #435381.
2002-01-31 18:56:00 +00:00
Fred Drake b94b849d65 Whitespace normalization. 2001-12-06 20:51:35 +00:00
Andrew M. Kuchling 045af6f8d8 [Bug #404274] Restore some special-case code for AIX and BeOS under 1.5.2.
This will have to stay until we decide to drop 1.5.2 compatibility
   completely.
2001-09-05 12:02:59 +00:00
Jack Jansen 212a2e1f9f On the mac some library paths returned were outdated, some were outright funny.
Fixed.
2001-09-04 12:01:49 +00:00
Greg Ward f17efb93d9 Patch #449054 to implement PEP 250. The standard install directory for
modules and extensions on Windows is now $PREFIX/Lib/site-packages.
Includes backwards compatibility code for pre-2.2 Pythons.  Contributed
by Paul Moore.
2001-08-23 20:53:27 +00:00
Fred Drake c916cdc5ca Miscellaneous minor cleanups. 2001-08-02 20:03:12 +00:00
Marc-André Lemburg 7cf92fa1c8 Add backwards compatibility. 2001-07-26 18:06:58 +00:00
Martin v. Löwis 4f1cd8bdcb Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
Fred Drake 70b014d3d3 Minor changes for stylistic cleanliness and consistency. 2001-07-18 18:39:56 +00:00
Guido van Rossum 99f9baa331 Fixed botched indent in _init_mac() code. (It may never be executed,
but it still can't have any syntax errors.  Went a little too fast
there, Jack? :-)
2001-05-17 15:03:14 +00:00
Jack Jansen dd13a20490 Made distutils understand the MacPython Carbon runtime model. Distutils will build for the runtime model you are currently using for the interpreter. 2001-05-17 12:52:01 +00:00
Andrew M. Kuchling 6335773434 Placate tabnanny 2001-02-28 19:40:27 +00:00
Neil Schemenauer 1a02086885 Linking just got simpiler on AIX and BeOS (closes SF patch #103679). 2001-02-16 03:31:13 +00:00
Neil Schemenauer 84d14baf94 There is no more Modules/Makefile, use toplevel Makefile. 2001-01-24 17:17:20 +00:00
Andrew M. Kuchling c14fa303e1 Patch #103279: sysconfig.py always looks for versions of files in
sys.prefix + 'config/Makefile'. When building Python for the first
time, these files aren't there, so the files from the build tree have
to be used instead; this file adds an entry point for specifying that
the build tree files should be used.  (Perhaps 'set_python_build' should
should be preceded with an underscore?)
2001-01-17 15:16:52 +00:00
Andrew M. Kuchling b11bd03626 Fix bugs with integer-valued variables when parsing Makefiles. Values
for done[n] can be integers as well as strings, but the code
concatenates them with strings (fixed by adding a str()) and calls
string.strip() on them (fixed by rearranging the logic)

(Presumably this wasn't noticed previously because parse_makefile()
was only called on Modules/Makefile, which contains no integer-valued
variables.)
2001-01-16 16:33:28 +00:00
Andrew M. Kuchling 0d36206afd Delete unused import of pprint module 2001-01-11 15:35:16 +00:00
Greg Ward d283ce7364 Added 'expand_makefile_vars()' to (duh) expand make-style variables
in a string (gives you something to do with the dictionary returned
  by 'parse_makefile()').
Pulled the regexes in 'parse_makefile()' out -- they're now globals,
  as 'expand_makefile_vars()' needs (two of) them.
Cosmetic tweaks to 'parse_makefile()'.
2000-09-17 00:53:02 +00:00
Greg Ward 879f0f11ba Changed from eager parsing of Makefile (at import time) to lazy: only do
all that work when someone asks for a "configuration variable" from the
Makefile.  Details:
  - added 'get_config_vars()': responsible for calling one of the
    '_init_*()' functions to figure things out for this platform,
    and to provide an interface to the resulting dictionary
  - added 'get_config_var()' as a simple interface to the dictionary
    loaded by 'get_config_vars()'
  - changed the '_init_*()' functions so they load the global dictionary
    '_config_vars', rather than spewing their findings all over
    the module namespace
  - don't delete the '_init_*()' functions when done importing
  - adjusted 'customize_compiler()' to the new regime
2000-09-15 01:15:08 +00:00
Greg Ward 3fff8d2969 Fixed so 'parse_makefile()' uses the TextFile class to ensure that
comments are stripped and lines are joined according to the backslash
convention.
2000-09-15 00:03:13 +00:00
Greg Ward 66e966f7bd Rene Liebscher: hack '_init_posix()' to handle the BeOS linker script.
(With a worry-wart comment added by me about where we *should* add the
Python library to the link.)
2000-09-01 01:23:26 +00:00
Greg Ward dc9fe8a7ba Typo fix. 2000-08-02 01:49:40 +00:00
Greg Ward 1d526dd3b3 Rene Liebscher: deleted unneeded hard-coded assignments of CC, RANLIB, etc.
in '_init_nt()' (they were kludges for CygwinCCompiler and no longer needed).
2000-08-02 01:09:11 +00:00
Greg Ward b231e1ae18 Oops, only do that AIX hack on AIX. 2000-06-27 01:59:43 +00:00
Greg Ward 4f880280c2 Fixed LDSHARED for AIX, based on a patch by Rene Liebscher.
Ditched my old code that fixed relative paths in the Makefile -- didn't work,
  doomed to failure, etc.
2000-06-27 01:59:06 +00:00
Greg Ward bb7baa793d Added the 'customize_compiler()' function, which plugs in the essential
information about building Python extensions that we discovered in
Python's makefile.  Currently only needed on Unix, so does nothing on
other systems.
2000-06-25 02:09:14 +00:00
Greg Ward 82d71cacb0 Added a bunch of new globals in '_init_mac()' -- these will be needed to
support the forthcoming Cygwin/Mingw32 GCC-on-Windows patch.
Standardized CVS id line.
2000-06-03 00:44:30 +00:00
Greg Ward a570c05997 Catch failure to open installed Makefile, and report it as a
DistutilsPlatformError: "invalid Python installation".  (This will
happen on Red Hat-ish systems where the python-devel package is not
installed.)
2000-05-23 23:14:00 +00:00
Greg Ward b1e4a6e101 Added kludge to deal with the "./ld_so_aix" problem: force all strings
in the Makefile that start with "./" to be absolute paths (with the
implied root being the directory where the Makefile itself was found).
2000-04-19 02:22:07 +00:00
Greg Ward 434ef8fe94 Don't load the config.h file, even under Unix, because we never use the
information from config.h.  Code is still there in case someone in the
future needs to parse an autoconf-generated config.h file.
2000-04-19 02:18:09 +00:00
Greg Ward b6f5adaa12 Don't bother reading config.h on NT or Mac OS. (It's not really needed
on Unix either, so should probably disappear entirely.)
2000-04-14 00:39:31 +00:00
Greg Ward d38e6f7637 Added optional 'prefix' arguments to 'get_python_inc()' and
'get_python_lib()'.
2000-04-10 01:17:49 +00:00
Greg Ward cf6bea3dc7 Better variable names here and there. 2000-04-10 01:15:06 +00:00
Fred Drake c1ee39a99e There are a few places which can raise DistutilsPlatformError; make
sure it's imported!  ;)

Re-wrap the docstrings on get_python_inc() and get_python_lib() to be
closer to the "normal" Python style.  See GvR's "style guide" on the
essays page (http://www.python.org/doc/essays/).

There should never be a space between a function name and the '(' that
opens the argument list (see the style guide again).
2000-03-09 15:54:52 +00:00
Greg Ward 7d73b9eb18 Added Joe Van Andel's 'get_python_inc()', adapted by me to supply
the platform-neutral include dir by default and with Mac support.
Added 'get_python_lib()', inspired by 'get_python_inc()'.
Rewrote 'get_config_h_filename()' and 'get_makefile_filename()'
  in terms of 'get_python_inc()' and 'get_python_lib()'.
Changed '_init_nt()' and '_init_mac()' to use 'get_python_inc()' and
  'get_python_lib()' for directory names.
2000-03-09 03:16:05 +00:00
Greg Ward 0eff87a570 Patch from Corran Webster <cwebster@nevada.edu>: add '_init_mac()'. 2000-03-07 03:30:09 +00:00
Fred Drake 69e2c6efbb get_config_h_filename(): Support NT as well as Posix systems.
_init_nt():  Use get_config_h_filename() instead of figuring out the
             name directly.

             g['SO'] should be set to '.pyd'.

             Adjust some minor coding nits.
2000-02-08 15:55:42 +00:00
Greg Ward a0ca3f24f9 Comment fix.
Always use normalized (with os.path.normpath()) versions of prefix and
  exec_prefix.
2000-02-02 00:05:14 +00:00
Greg Ward 32162e832e Patch from Perry Stoll: tweaks to Windows support. 1999-08-29 18:22:13 +00:00
Greg Ward 4d74d73b07 Now handles NT, through '_init_nt()' function (courtesy of
Amos Latteier <amos@aracnet.com>).
1999-06-08 01:58:36 +00:00
Fred Drake 6a1b53c165 get_config_h_filename(): Fix to work with current Python
installations; it was picking up a stale config.h from an
	overwritten installation.
1999-01-11 15:34:55 +00:00
Fred Drake 522af3a126 Update and add docstrings. 1999-01-06 16:28:34 +00:00