Commit Graph

48 Commits

Author SHA1 Message Date
Skip Montanaro 628e3bf6cf MacOSX linker doesn't understand -R flag at all, no matter how you feed it
the flag.  Punt and return a -L flag instead (returning "" gums up the
command to be forked).
2002-10-09 21:37:18 +00:00
Andrew M. Kuchling df453fd026 The .preprocess() method didn't work, because it didn't add the input file
to the command-line arguments.  Fix this by adding the source filename.
2002-09-09 12:16:58 +00:00
Jeremy Hylton 1b046e4314 Add implementation of _compile() and use default compile() method. 2002-06-18 18:48:55 +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 129b17d538 More style changes and little cleanups.
Remove __init__ that just called base class __init__ with same args.
Fold long argument lists into fewer, shorter lines.
Remove parens in tuple unpacks.
Don't put multiple statements on one line with a semicolon.
In find_library_file() compute the library_filename() upfront.
2002-06-13 15:14:10 +00:00
Jeremy Hylton 022640dea0 Some more style improvements 2002-06-13 15:01:38 +00:00
Jeremy Hylton 28f46e1839 Python style conformance: Delete spaces between name of function and arglist.
Making the world better a little bit at a time <wink>.
2002-06-13 14:58:30 +00:00
Jeremy Hylton 332a146127 Remove unused imports caught by pychecker 2002-06-04 20:18:24 +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
Just van Rossum 005dbb219e on MacOSX/Darwin, use ranlib when building static libs. 2002-02-11 15:31:50 +00:00
Fred Drake d15db5c711 When using GCC, use the right option to add a directory to the list of dirs
searched for a dependency for runtime linking.
This closes SF bug #445902.
2001-12-11 05:04:24 +00:00
Fred Drake b94b849d65 Whitespace normalization. 2001-12-06 20:51:35 +00:00
Jack Jansen e259e5980c Patch by Bill Noon: added 'dylib' as a library type along with
'static' and 'shared'. This fixes extension building for dynamic
Pythons on MacOSX.
2001-08-27 15:08:16 +00:00
Guido van Rossum 63a47402b3 Fix a mismatched parenthesis in the last patch. 2001-07-16 14:46:13 +00:00
Andrew M. Kuchling 286b107bea [Bug #441527] Fixes for preprocessor support, contributed by Tarn
Weisner Burton
2001-07-16 14:19:20 +00:00
Andrew M. Kuchling 7880e5ecd7 Patch #413912 from Steve Majewski: Add .m to the list of extensions
in order to support Objective-C.
2001-04-05 15:46:48 +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 be86bdea73 Standardize whitespace in function calls. 2000-09-26 01:56:15 +00:00
Greg Ward e5e6015e5a Added 'debug' flag to 'find_library_file()'. 2000-08-04 01:28:39 +00:00
Greg Ward 7499847c53 Fix to call 'library_filename()' instead of the non-existent
'shared_library_filename()'.
2000-07-27 01:23:19 +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 73076ff754 Got rid of direct dependence on the sysconfig module. Mainly, this
meant playing along with the new "dictionary of executables" scheme
added to CCompiler by adding the 'executables' class attribute, and
changing all the compile/link/etc. methods to use the new attributes
(which encapsulate both the program to run and its standard arguments,
so it was a *little* bit more than just changing some names).
2000-06-25 02:05:29 +00:00
Greg Ward 3ff3b039ac Added 'preprocess()' method to CCompiler interface, and implemented
it in UnixCCompiler.  Still needs to be implemented in MSVCCompiler (and
whatever other compiler classes are lurking out there, waiting to be
checked in).
2000-06-21 02:58:46 +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 8eef583025 Don't run "ranlib" if sysconfig's RANLIB (from Python's Makefile) starts
with ":".
2000-04-14 13:53:34 +00:00
Greg Ward 1c79330e64 Cleaned up use of sysconfig module a bit: don't import more names
than we actually use, and do actually use AR and SO.
Run ranlib on static libraries.  (Should probably have a platform-check
  so we don't run ranlib when it's not necessary, ie. on most modern
  Unices.)
2000-04-14 00:48:15 +00:00
Greg Ward e21dabe2e0 Added 'runtime_library_dirs' parameter to 'link_*()' methods, and changed to
use it when linking.
Call '_fix_object_args()' and/or '_fix_lib_args()' as appropriate, rather
  than just '_fix_link_args()'.
2000-03-26 21:40:19 +00:00
Greg Ward d03f88a38f Changed to pay attention to the 'runtime_library_dirs' list (= 'rpath'
option in the 'build_ext' command):
  * in ccompiler.py: 'gen_lib_options()' now takes 'runtime_library_dirs'
    parameter
  * in unixccompiler.py and msvccompiler.py: now pass
    'self.runtime_library_dirs' to 'gen_lib_options()', and define
    'runtime_library_dir_option()' (although in msvccompiler.py it
    blows up with a DistutilsPlatformError right now!)
2000-03-18 15:19:51 +00:00
Greg Ward 036c805958 Renamed 'link_static_lib() to 'create_static_lib()'. 2000-03-10 01:48:32 +00:00
Greg Ward 32c4a8a0ee Serious overhaul of the C compiler interface and the two classes that
implement it (so far):
  * moved filename generation methods into CCompiler base class,
    driven by data supplied by implementation classes
  * moved a bunch of common code from UnixCCompiler to convenience
    methods in CCompiler
  * overhauled MSVCCompiler's compile/link methods to look and act
    as much as possible like UnixCCompiler's, in order to regularize
    both interface and behaviour (especially by using those new
    convenience methods)
2000-03-06 03:40:29 +00:00
Greg Ward 3ce77fd05e Changed '__rcsid__' to '__revision__'. 2000-03-02 01:49:45 +00:00
Greg Ward 49ffce173e In the 'compile()' method: preserve the directory portion of source
filenames when constructing object filenames, even if output_dir given --
eg. "foo/bar.c" will compile to "foo/bar.o" without an output_dir, and to
"temp/foo/bar.o" if output_dir is "temp".
2000-03-02 01:21:54 +00:00
Greg Ward f1146572dd In compile/link methods: ensure that the directory we expect to be writing to
exists before calling the compiler/linker.
2000-03-01 14:43:49 +00:00
Greg Ward 10ca82b57c Typecheck 'output_dir' argument to compile/link methods. 2000-02-10 02:51:32 +00:00
Greg Ward ba233fbe92 Added 'debug' flags to compile and link methods, and modified code to add
'-g' flag to compiler/linker command lines when it's true.
2000-02-09 02:17:00 +00:00
Greg Ward ef6f515d49 Changed 'compile()' method to compile files one-at-a-time -- gives better
feedback and, theoretically, the opportunity to set compiler flags
on a per-file basis.
2000-02-03 23:07:19 +00:00
Greg Ward c9f3187be2 Abstracted '_fix_link_args()' out of 'link_shared_object()'.
Added 'link_static_lib()' method, and 'archiver' and 'archiver_options'
  class attributes to support it.
Added 'link_executable()' method, and 'ld_exec' instance attribute
  to support it.
'newer_group()' is now able to handle missing files, so we don't have
  to kludge it by catching OSError when calling it.
'object_filenames()' and 'shared_object_filename()' now take 'keep_dir'
  flag parameters.
'library_filename()' and 'shared_library_filename()' now respect
  a directory component in the library name.
Various comment updates/deletions.
2000-01-09 22:47:53 +00:00
Greg Ward 04d78328f3 In 'compile()' method, renamed 'includes' parameter to 'include_dirs' for
consistency with 'build_ext' command option.
Changed 'compile()' and 'link_shared_object()' so 'include_dirs',
  'libraries', and 'library_dirs' can be lists or tuples.
1999-12-12 16:57:47 +00:00
Greg Ward 4fecfce4d0 Fixed order of link options: object files now precede library stuff.
Catch up with changes in 'gen_lib_options()':
  - change how we call it
  - added methods 'library_dir_option()', 'library_option()', and
    'find_library_file()' that it calls
Added 'force' flag and changed compile/link methods to respect it.
1999-10-03 20:45:33 +00:00
Greg Ward 0e3530ba28 Catch up with latest changes in CCompiler:
- add 'extra_preargs' and 'extra_postargs' parameters (and use them!)
  - added 'compiler_type' class attribute
  - respect reordered arguments to 'gen_lib_options()'
1999-09-29 12:22:50 +00:00
Greg Ward b116e45a29 In 'link_shared_object()', try to be less sensitive to missing input files
in dry-run mode.
1999-09-21 18:36:15 +00:00
Greg Ward 8037cb11f5 Added 'output_dir' parameter to 'compile()' and 'link_shared_object().
Changed those two methods to only compile/link if necessary (according
  to simplistic timestamp checks).
Added 'output_dir' to 'object_filenames()' and 'shared_object_filename()'.
1999-09-13 03:12:53 +00:00
Greg Ward c294113f18 Ditched '_gen_preprocess_options()' and '_gen_lib_options()' -- they're
now provided (minus the leading underscore) by the ccompiler module.
Fix 'compile()' to return the list of object files generated.
Cosmetic tweaks/delete cruft.
1999-09-08 02:32:19 +00:00
Greg Ward 65f4a3b173 Patch from Perry Stoll: caught up with changes in CCompiler necessary (?)
for MSVCCompiler.
1999-08-29 18:23:32 +00:00
Greg Ward 5e71744000 Changed to use 'spawn()', now that it exists.
Added 'verbose' and 'dry_run' parameters to constructor.
Changed 'compile()', 'link_*()' to default lists arguments to None
  rather than empty list.
Added implementations of the filename-mangling methods mandated by
  the CCompiler interface.
1999-08-14 23:53:53 +00:00
Greg Ward 170bdc08e1 The first concrete subclass of CCompiler: defines a barebones Unix C compiler. 1999-07-10 02:04:22 +00:00