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 …
[View More]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
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():
[View Less]
The first Python interpreter on my path is in /www/python/bin. I was
building some RPMs today where I wanted to use the interpreter that
comes with Red Hat, so I ran '/usr/bin/python1.5 setup.py bdist_rpm',
and found that the RPM build script just uses 'python', so it found
the first one on my path, which isn't the same as the one I wanted.
Question: should the RPM build script hard-core the full path of the
interpreter binary, or does it cause problems? If specifying the full
path is OK, …
[View More]here's a patch. (Harry, or someone else who knows RPM,
should approve of this patch before considering checking it in.)
--amk
Index: bdist_rpm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v
retrieving revision 1.17
diff -C2 -r1.17 bdist_rpm.py
*** bdist_rpm.py 2000/08/15 13:05:35 1.17
--- bdist_rpm.py 2000/09/01 15:28:35
***************
*** 8,12 ****
__revision__ = "$Id: bdist_rpm.py,v 1.17 2000/08/15 13:05:35 gward Exp $"
! import os, string
import glob
from types import *
--- 8,12 ----
__revision__ = "$Id: bdist_rpm.py,v 1.17 2000/08/15 13:05:35 gward Exp $"
! import os, string, sys
import glob
from types import *
***************
*** 400,406 ****
# figure out default build script
if self.use_rpm_opt_flags:
! def_build = 'env CFLAGS="$RPM_OPT_FLAGS" python setup.py build'
else:
! def_build = 'python setup.py build'
# insert contents of files
--- 400,407 ----
# figure out default build script
if self.use_rpm_opt_flags:
! def_build = ('env CFLAGS="$RPM_OPT_FLAGS" %s setup.py build'
! % sys.executable )
else:
! def_build = '%s setup.py build' % sys.executable
# insert contents of files
[View Less]
I was wondering if it might be a good idea to put a function in Distutils
that could query if the currently installed version has certain
abilities. Each ability could be assigned a name, and it could be
implemented very simply:
(in setup.py)
try:
if not check_ability('a'):
raise Exception # to be caught and reraised as SystemExit
except: # for versions of Distutils without check_ability(), or without 'a'
raise SystemExit, 'This package requires a more recent version of Distutils'
(…
[View More]somewhere in the Distutils)
def check_ability(ability):
''' Return true if ability is supported by Distutils '''
return ability in ['a', 'b', 'c']
--
Harry Henry Gebel, Senior Developer, Landon House SBS ICQ# 76308382
West Dover Hundred, Delaware
[View Less]