diff options
author | Greg Ward <gward@python.net> | 2000-02-10 02:17:06 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-02-10 02:17:06 (GMT) |
commit | 968d883be5bd20647d764badcca1621e4bc697c9 (patch) | |
tree | ad68d551972fae69f7fe4cea62f57ebd5d012e08 | |
parent | 4ba9b2e3b64c31b488b1454c9ec4c8e0e2d7da9d (diff) | |
download | cpython-968d883be5bd20647d764badcca1621e4bc697c9.zip cpython-968d883be5bd20647d764badcca1621e4bc697c9.tar.gz cpython-968d883be5bd20647d764badcca1621e4bc697c9.tar.bz2 |
Path from Thomas Heller: resurrect the .def file kludge while preserving the
/export option mini-kludge.
-rw-r--r-- | Lib/distutils/command/build_ext.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 14c2234..42eab47 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -241,9 +241,21 @@ class BuildExt (Command): libraries = build_info.get ('libraries') library_dirs = build_info.get ('library_dirs') extra_args = build_info.get ('extra_link_args') or [] + if self.compiler.compiler_type == 'msvc': - mod_name = string.split (extension_name, '.')[-1] - extra_args.append ('/export:init%s' % mod_name) + def_file = build_info.get ('def_file') + if def_file is None: + source_dir = os.path.dirname (sources[0]) + ext_base = (string.split (extension_name, '.'))[-1] + def_file = os.path.join (source_dir, "%s.def" % ext_base) + if not os.path.exists (def_file): + def_file = None + + if def_file is not None: + extra_args.append ('/DEF:' + def_file) + else: + modname = string.split (extension_name, '.')[-1] + extra_args.append('/export:init%s'%modname) ext_filename = self.extension_filename \ (extension_name, self.package) |