I am trying to install numpy and am first installing distutils. I am running SunOS 5.7 on a sparc Ultra-4. I installed Python after downloading it from python.org. When I try to install distutils, it reports that it cannot find the <exec-prefix>/lib/python1.5/config and indeed there is no such directory in the python distribution that I can see. Fred Clare fred@ucar.edu
Patch follows. Bastian Kleineidam diff -BurN --minimal --exclude=*.pyc distutils.orig/distutils/command/build_ext.py distutils/distutils/command/build_ext.py --- distutils.orig/distutils/command/build_ext.py Thu Jul 13 01:15:27 2000 +++ distutils/distutils/command/build_ext.py Fri Jul 14 14:02:38 2000 @@ -309,7 +309,7 @@ def get_source_files (self): - self.check_extension_list() + self.check_extensions_list(self.extensions) filenames = [] # Wouldn't it be neat if we knew the names of header files too...
Hello, the findall function in sdist.py gives an error when a broken link is found. The responsible function call is os.stat(). I replaced the stat() calls with os.path.{isfile,islink,isdir}. This is somewhat more robust. The new findall is now a member function of the sdist class so I can use self.announce to warn about broken links. Here is the patch: diff -BurN --minimal --exclude=*.pyc distutils.orig/distutils/command/sdist.py distutils/distutils/command/sdist.py --- distutils.orig/distutils/command/sdist.py Thu Jul 13 01:15:28 2000 +++ distutils/distutils/command/sdist.py Fri Jul 14 15:47:05 2000 @@ -324,7 +324,7 @@ containing a Unix-style glob pattern). If 'pattern' is None, find all files under 'dir'. Return the list of found filenames. """ - allfiles = findall (dir) + allfiles = self.findall (dir) if pattern is None: return allfiles @@ -376,7 +376,7 @@ rstrip_ws=1, collapse_ws=1) - all_files = findall () + all_files = self.findall () while 1: @@ -695,43 +695,42 @@ """ return self.archive_files -# class sdist - + def findall(self, dir = os.curdir): + """Find all files under 'dir' and return the list of full filenames + (relative to 'dir'). + """ + list = [] + stack = [dir] + pop = stack.pop + push = stack.append -# ---------------------------------------------------------------------- -# Utility functions + while stack: + dir = pop() + names = os.listdir (dir) -def findall (dir = os.curdir): - """Find all files under 'dir' and return the list of full filenames - (relative to 'dir'). - """ - from stat import ST_MODE, S_ISREG, S_ISDIR, S_ISLNK + for name in names: + if dir != os.curdir: # avoid the dreaded "./" syndrome + fullname = os.path.join (dir, name) + else: + fullname = name - list = [] - stack = [dir] - pop = stack.pop - push = stack.append + # note: isfile follows symlinks + if os.path.isfile(fullname): + list.append (fullname) + elif os.path.islink(fullname): + self.announce("warning: link %s is broken" % fullname) + elif os.path.isdir(fullname): + push (fullname) - while stack: - dir = pop() - names = os.listdir (dir) + return list - for name in names: - if dir != os.curdir: # avoid the dreaded "./" syndrome - fullname = os.path.join (dir, name) - else: - fullname = name + # findall - # Avoid excess stat calls -- just one will do, thank you! - stat = os.stat(fullname) - mode = stat[ST_MODE] - if S_ISREG(mode): - list.append (fullname) - elif S_ISDIR(mode) and not S_ISLNK(mode): - push (fullname) +# class sdist - return list +# ---------------------------------------------------------------------- +# Utility functions def glob_to_re (pattern): """Translate a shell-like glob pattern to a regular expression; return
On Fri, Jul 14, 2000 at 03:56:41PM +0200, Bastian Kleineidam wrote:
I replaced the stat() calls with os.path.{isfile,islink,isdir}. This is somewhat more robust. The new findall is now a member function of the sdist class so I can use self.announce to warn about broken links.
The reorganization, though minor, is enough to make me shy about checking it in without Greg's approval. I'd encourage you to go to the SourceForge patch manager for Python (http://sourceforge.net/patch/?group_id=5470) and check it in, so it doesn't get lost. --amk
On 14 July 2000, Bastian Kleineidam said:
the findall function in sdist.py gives an error when a broken link is found. The responsible function call is os.stat().
I replaced the stat() calls with os.path.{isfile,islink,isdir}. This is somewhat more robust. The new findall is now a member function of the sdist class so I can use self.announce to warn about broken links.
I've looked into this a bit and decided it's a feature. (Ie., it'd be too hard to fix it properly.) It boils down to this: the 'findall()' routine in sdist.py isn't the only place that pokes about the filesystem looking for stuff; to do this right, we would have to detect dangling links in all such places. (The only other place I can think of offhand is in built_py.py, where we turn the packages listed in the 'packages' list into a list of filenames.) Or we could have a single function or class whose job it is to walk the filesystem looking for stuff: that's probably the right way, and the filesystem-searching code in sdist.py is general enough that it wouldn't take much to extract it and make it into something useful across the whole of the Distutils. But, on reflection, I'm not going to bother. In an ideal world, we'd warn about dangling links and then skip them. In a bad world, we'd include dangling links in tarballs. Blowing up when we hit dangling links isn't the best, but it isn't the worst either. Greg PS. what an appropriate fortune for this post... -- Greg Ward - maladjusted nerd gward@python.net http://starship.python.net/~gward/ Save energy: be apathetic.
Hello, if the Distutils bail out on broken links we will run into problems with Debian packages. I am calling the dh_undocumented script which generates the link debian/tmp/usr/share/man/man1/linkchecker.1.gz -> ../man7/undocumented.7.gz which is broken only temporarily, but not after installing the generated .deb package. Well, I will have to make symlinks with absolute pathnames.. Bastian
On 27 July 2000, Bastian Kleineidam said:
if the Distutils bail out on broken links we will run into problems with Debian packages. I am calling the dh_undocumented script which generates the link debian/tmp/usr/share/man/man1/linkchecker.1.gz -> ../man7/undocumented.7.gz which is broken only temporarily, but not after installing the generated .deb package.
Oh, bother! OK, I'll try to come up with a decent fix for this. Now that the "grope about the filesystem looking for stuff" code has been factored out of sdist.py, I think this is the place to detect broken links. Then it's just a question of making sure the "find all modules in package X" code in build_py.py uses file_list.py. I think this will have to wait until after 0.9.1, unless someone presents me with an irresistably perfect patch in the next 24 hours. Greg -- Greg Ward - geek-on-the-loose gward@python.net http://starship.python.net/~gward/ I just heard the SEVENTIES were over!! And I was just getting in touch with my LEISURE SUIT!!
Hi, in the latest CVS version the lines from distutils.dir_util import * from distutils.file_util import * in util.py are missing. Bastian Kleineidam
On 05 August 2000, Bastian Kleineidam said:
in the latest CVS version the lines
from distutils.dir_util import * from distutils.file_util import *
in util.py are missing.
No, they were deliberately deleted. ("missing" implies this was accidental, which it was not.) I *thought* I caught all the import problems that this introduced, but if I missed any please let me know where! (And if it caused problems in your own code... too bad. Sorry, but those "import *"'s were a backwards compatibility hack that only should have been there for a week or two, but I got lazy.) Greg -- Greg Ward - just another Python hacker gward@python.net http://starship.python.net/~gward/ I'd like some JUNK FOOD ... and then I want to be ALONE --
On 12 July 2000, fred said:
I am trying to install numpy and am first installing distutils. I am running SunOS 5.7 on a sparc Ultra-4. I installed Python after downloading it from python.org. When I try to install distutils, it reports that it cannot find the <exec-prefix>/lib/python1.5/config and indeed there is no such directory in the python distribution that I can see.
Sorry for the delay -- I've been away on holiday, and then I took a few more days holiday from Distutils hacking (or reading the sig, or applying patches, or any of that stuff). Anyways -- has this problem been resolved? Bastian posted a patch in reply, but I wasn't clear if the patch was in any way related to your problem -- it just looked like a silly little typo fix. So are you still unable to install the Distutils? If the lib/python1.5/config directory doesn't exist, the Distutils are useless. Greg -- Greg Ward - Unix nerd gward@python.net http://starship.python.net/~gward/ Animals can be driven crazy by placing too many in too small a pen. Homo sapiens is the only animal that voluntarily does this to himself.
participants (4)
-
Andrew Kuchling
-
Bastian Kleineidam
-
fred
-
Greg Ward