[Distutils] some small bugs

Rene Liebscher R.Liebscher@gmx.de
Thu, 17 Aug 2000 13:45:51 +0200


This is a multi-part message in MIME format.
--------------C024D49164D0E627B3792EBD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

While playing with distutils, I found
some (old) bugs.

If your distribution directory for bdist
doesn't exist, distutils doesn't create
it. (Even the default 'dist', so distutils
fails if you use bdist for the first time.)

bdist_wininst fails if no long description
exists. It should warn about this, and go ahead.

And a new introduced one in bcppcompiler.py
It uses the first object file's path name to
get the directory for its def-file. But if there is
another object placed at the first position, this 
doesn't work. The patch moves these parts to their
right position.
The patch also changes the prefered library names
from bcpp_xxx.lib to xxx_bcpp.lib.


The next is not a bug.
I tried distutils with BeOS R5. BeOS uses also some
linker scripts (as AIX does.) But in the Makefile are
again the wrong pathnames to these scripts. So we have
to correct this as for AIX in sysconfig.py.
(Python doesn't install these scripts, I will
put a patch for its Makefile.in to sourceforge.)


And finally some corrections to the comments
in my cygwinccompiler class.


Kind regards

Rene Liebscher
--------------C024D49164D0E627B3792EBD
Content-Type: text/plain; charset=us-ascii;
 name="rene.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="rene.patch"

diff -BurN --minimal --exclude=*.pyc distutils.orig/distutils/bcppcompiler.py distutils.patched/distutils/bcppcompiler.py
--- distutils.orig/distutils/bcppcompiler.py	Mon Aug 14 15:13:04 2000
+++ distutils.patched/distutils/bcppcompiler.py	Thu Aug 17 12:58:03 2000
@@ -224,17 +224,6 @@
             else:
                 ld_args = self.ldflags_shared[:]
 
-            # Borland C++ has problems with '/' in paths
-            objects = map(os.path.normpath, objects)
-            startup_obj = 'c0d32'
-            objects.insert(0, startup_obj)
-
-            # either exchange python15.lib in the python libs directory against
-            # a Borland-like one, or create one with name bcpp_python15.lib 
-            # there and remove the pragmas from config.h  
-            libraries.append ('import32')
-            libraries.append ('cw32mt')
-
             # Create a temporary exports file for use by the linker
             head, tail = os.path.split (output_filename)
             modname, ext = os.path.splitext (tail)
@@ -246,6 +235,17 @@
             self.execute(write_file, (def_file, contents),
                          "writing %s" % def_file)
 
+            # Borland C++ has problems with '/' in paths
+            objects = map(os.path.normpath, objects)
+            startup_obj = 'c0d32'
+            objects.insert(0, startup_obj)
+
+            # either exchange python15.lib in the python libs directory against
+            # a Borland-like one, or create one with name bcpp_python15.lib 
+            # there and remove the pragmas from config.h  
+            libraries.append ('import32')
+            libraries.append ('cw32mt')
+
             # Start building command line flags and options.
 
             for l in library_dirs:
@@ -377,9 +377,9 @@
         # seems to have a different format for static libraries.
         if debug:
             dlib = (lib + "_d")
-            try_names = ("bcpp_" + dlib, "bcpp_" + lib, dlib, lib)
+            try_names = (dlib + "_bcpp", lib + "_bcpp", dlib, lib)
         else:
-            try_names = ("bcpp_" + lib, lib)
+            try_names = (lib + "_bcpp", lib)
 
         for dir in dirs:
             for name in try_names:
diff -BurN --minimal --exclude=*.pyc distutils.orig/distutils/command/bdist.py distutils.patched/distutils/command/bdist.py
--- distutils.orig/distutils/command/bdist.py	Thu Aug  3 11:00:00 2000
+++ distutils.patched/distutils/command/bdist.py	Thu Aug 17 13:14:58 2000
@@ -102,6 +102,9 @@
 
     def run (self):
 
+        # create dist directory 
+        self.mkpath(self.dist_dir)
+        
         for format in self.formats:
             try:
                 cmd_name = self.format_command[format][0]
diff -BurN --minimal --exclude=*.pyc distutils.orig/distutils/command/bdist_wininst.py distutils.patched/distutils/command/bdist_wininst.py
--- distutils.orig/distutils/command/bdist_wininst.py	Tue Aug  8 13:18:38 2000
+++ distutils.patched/distutils/command/bdist_wininst.py	Thu Aug 17 13:08:20 2000
@@ -137,8 +137,12 @@
 
         # 'info' will be displayed in the installer's dialog box,
         # describing the items to be installed.
-        info = metadata.long_description + '\n'
-
+        if metadata.long_description:
+            info = metadata.long_description + '\n'
+        else:
+            self.warn ('no long_description available')
+            info = ''
+            
         for name in dir (metadata):
             if (name != 'long_description'):
                 data = getattr (metadata, name)
diff -BurN --minimal --exclude=*.pyc distutils.orig/distutils/cygwinccompiler.py distutils.patched/distutils/cygwinccompiler.py
--- distutils.orig/distutils/cygwinccompiler.py	Mon Aug 14 15:13:04 2000
+++ distutils.patched/distutils/cygwinccompiler.py	Thu Aug 17 12:59:50 2000
@@ -18,7 +18,7 @@
 #
 #   see also http://starship.python.net/crew/kernr/mingw32/Notes.html
 #
-# * We use put export_symbols in a def-file, and don't use 
+# * We put export_symbols in a def-file, and don't use 
 #   --export-all-symbols because it doesn't worked reliable in some
 #   tested configurations. And because other windows compilers also
 #   need their symbols specified this no serious problem.
@@ -32,7 +32,7 @@
 #   (ld doesn't support -shared, so we use dllwrap)   
 # * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now
 #   - its dllwrap doesn't work, there is a bug in binutils 2.10.90
-#     see also .....
+#     see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html
 #   - using gcc -mdll instead dllwrap doesn't work without -static because 
 #     it tries to link against dlls instead their import libraries. (If
 #     it finds the dll first.)
diff -BurN --minimal --exclude=*.pyc distutils.orig/distutils/sysconfig.py distutils.patched/distutils/sysconfig.py
--- distutils.orig/distutils/sysconfig.py	Thu Aug  3 11:00:00 2000
+++ distutils.patched/distutils/sysconfig.py	Thu Aug 17 13:05:20 2000
@@ -254,6 +254,15 @@
         python_exp = os.path.join(python_lib, 'config', 'python.exp')
 
         g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
+    if sys.platform == 'beos':
+        # Linker script is in the BeOS directory instead the config
+        # directory. In the Makefile it is relative to the srcdir which after
+        # installation no longer makes sense
+        python_lib = get_python_lib(standard_lib=1)
+        linkerscript_name = os.path.basename(string.split(g['LDSHARED'],' ')[0])
+        linkerscript = os.path.join(python_lib, 'BeOS', linkerscript_name)
+        g['LDSHARED'] = ("%s -L%s/lib -lpython%s" 
+                                   % (linkerscript,sys.prefix,sys.version[0:3]))
 
 
 def _init_nt():

--------------C024D49164D0E627B3792EBD--