ports/79064: Patchset for scons-0.96.90 to unbreak graphics/blender-devel

Michal Varga varga at stonehenge.sk
Sun Mar 20 23:10:03 UTC 2005


>Number:         79064
>Category:       ports
>Synopsis:       Patchset for scons-0.96.90 to unbreak graphics/blender-devel
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 20 23:10:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Michal Varga
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
Stonehenge
>Environment:
System: FreeBSD xenon.stonehenge.sk 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Sat Mar 19 20:11:17 CET 2005 root at xenon.stonehenge.sk:/usr/obj/usr/src/sys/KERNEL i386


	
>Description:
Patches for portions of scons 0.96.90 to unbreak build of
graphics/blender-devel, obtained from latest scons CVS. Successfully
tested with other two ports depending on scons (fsplib, kdissert), both
work.
>How-To-Repeat:
	
>Fix:
diff -rNu devel/scons/files/patch-node-FS.py devel/scons.new/files/patch-node-FS.py
--- devel/scons/files/patch-node-FS.py	Thu Jan  1 01:00:00 1970
+++ devel/scons.new/files/patch-node-FS.py	Sat Mar 19 23:43:26 2005
@@ -0,0 +1,312 @@
+--- engine/SCons/Node/FS.py.orig	Wed Feb 16 03:12:10 2005
++++ engine/SCons/Node/FS.py	Tue Mar  8 19:08:43 2005
+@@ -756,7 +756,7 @@
+ 
+         The path argument must be a valid absolute path.
+         """
+-        if __debug__: logInstanceCreation(self)
++        if __debug__: logInstanceCreation(self, 'Node.FS')
+         self.Top = None
+         if path == None:
+             self.pathTop = os.getcwd()
+@@ -999,15 +999,11 @@
+             self.__setTopLevelDir()
+             self.Top.addRepository(d)
+ 
+-    def do_Rsearch(self, path, func, clazz=_classEntry, cwd=None, verbose=lambda x: x):
++    def do_Rsearch(self, path, dir, func, clazz=_classEntry):
+         """Search for something in a Repository.  Returns the first
+         one found in the list, or None if there isn't one.
+         __cacheable__
+         """
+-        if isinstance(path, SCons.Node.Node):
+-            return path
+-
+-        path, dir = self.__transformPath(path, cwd)
+         d, name = os.path.split(path)
+         norm_name = _my_normcase(name)
+         if d:
+@@ -1021,8 +1017,7 @@
+             if node:
+                 dir = node.get_dir()
+         if node:
+-            verbose("... FOUND '%s' in '%s'\n" % (name, dir))
+-            return node
++            return node, dir
+         fname = '.'
+         while dir:
+             for rep in dir.getRepositories():
+@@ -1034,19 +1029,21 @@
+                 else:
+                     node = func(node)
+                 if node:
+-                    verbose("... FOUND '%s' in '%s'\n" % (name, dir))
+-                    return node
++                    return node, dir
+             fname = dir.name + os.sep + fname
+             dir = dir.get_dir()
+-        return None
++        return None, None
+ 
+     def Rsearch(self, path, clazz=_classEntry, cwd=None):
++        if isinstance(path, SCons.Node.Node):
++            return path
+         def func(node):
+             if node.exists() and \
+                (isinstance(node, Dir) or not node.is_derived()):
+                    return node
+             return None
+-        return self.do_Rsearch(path, func, clazz, cwd)
++        path, dir = self.__transformPath(path, cwd)
++        return self.do_Rsearch(path, dir, func, clazz)[0]
+ 
+     def Rsearchall(self, pathlist, must_exist=1, clazz=_classEntry, cwd=None):
+         """Search for a list of somethings in the Repository list.
+@@ -1087,10 +1084,6 @@
+             else:
+                 if not must_exist or node.exists():
+                     result.append(node)
+-                if isinstance(node, Dir):
+-                    result.extend(filter(select, node.getRepositories()))
+-                if node:
+-                    dir = node.get_dir()
+             fname = '.'
+             while dir:
+                 for rep in dir.getRepositories():
+@@ -1286,6 +1279,36 @@
+         if not self.builder is MkdirBuilder:
+             apply(SCons.Node.Node.build, [self,], kw)
+ 
++    def _create(self):
++        """Create this directory, silently and without worrying about
++        whether the builder is the default or not."""
++        listDirs = []
++        parent = self
++        while parent:
++            if parent.exists():
++                break
++            listDirs.append(parent)
++            p = parent.up()
++            if isinstance(p, ParentOfRoot):
++                raise SCons.Errors.StopError, parent.path
++            parent = p
++        listDirs.reverse()
++        for dirnode in listDirs:
++            try:
++                # Don't call dirnode.build(), call the base Node method
++                # directly because we definitely *must* create this
++                # directory.  The dirnode.build() method will suppress
++                # the build if it's the default builder.
++                SCons.Node.Node.build(dirnode)
++                dirnode.get_executor().nullify()
++                # The build() action may or may not have actually
++                # created the directory, depending on whether the -n
++                # option was used or not.  Delete the _exists and
++                # _rexists attributes so they can be reevaluated.
++                dirnode.clear()
++            except OSError:
++                pass
++
+     def multiple_side_effect_has_builder(self):
+         global MkdirBuilder
+         return not self.builder is MkdirBuilder and self.has_builder()
+@@ -1383,24 +1406,59 @@
+         sccspath = 'SCCS' + os.sep + 's.'+name
+         return self.entry_exists_on_disk(sccspath)
+ 
+-    def srcdir_duplicate(self, name, clazz):
+-        dname = '.'
++    def srcdir_list(self):
++        """__cacheable__"""
++        result = []
++
++        dirname = '.'
+         dir = self
+         while dir:
+             if dir.srcdir:
+-                srcdir = dir.srcdir.Dir(dname)
+-                if srcdir.entry_exists_on_disk(name):
+-                    srcnode = self.fs._doLookup(clazz, name, srcdir)
+-                    if self.duplicate:
+-                        node = self.fs._doLookup(clazz, name, self)
+-                        node.do_duplicate(srcnode)
+-                        return node
+-                    else:
+-                        return srcnode
+-            dname = dir.name + os.sep + dname
++                d = dir.srcdir.Dir(dirname)
++                if d.is_under(dir):
++                    # Shouldn't source from something in the build path:
++                    # build_dir is probably under src_dir, in which case
++                    # we are reflecting.
++                    break
++                result.append(d)
++            dirname = dir.name + os.sep + dirname
+             dir = dir.get_dir()
++
++        return result
++
++    def srcdir_duplicate(self, name, clazz):
++        for dir in self.srcdir_list():
++            if dir.entry_exists_on_disk(name):
++                srcnode = self.fs._doLookup(clazz, name, dir)
++                if self.duplicate:
++                    node = self.fs._doLookup(clazz, name, self)
++                    node.do_duplicate(srcnode)
++                    return node
++                else:
++                    return srcnode
+         return None
+ 
++    def srcdir_find_file(self, filename):
++        """__cacheable__"""
++        fs = self.fs
++        do_Rsearch = fs.do_Rsearch
++
++        def func(node):
++            if isinstance(node, SCons.Node.FS.File) and \
++               (node.is_derived() or node.is_pseudo_derived() or node.exists()):
++                    return node
++            return None
++
++        node, d = do_Rsearch(filename, self, func, File)
++        if node:
++            return node, d
++
++        for dir in self.srcdir_list():
++            node, d = do_Rsearch(filename, dir, func, File)
++            if node:
++                return File(filename, self, fs), d
++        return None, None
++
+     def node_on_disk(self, name, clazz):
+         if self.entry_exists_on_disk(name) or \
+            self.sccs_on_disk(name) or \
+@@ -1542,33 +1600,7 @@
+     def _createDir(self):
+         # ensure that the directories for this node are
+         # created.
+-
+-        listDirs = []
+-        parent=self.dir
+-        while parent:
+-            if parent.exists():
+-                break
+-            listDirs.append(parent)
+-            p = parent.up()
+-            if isinstance(p, ParentOfRoot):
+-                raise SCons.Errors.StopError, parent.path
+-            parent = p
+-        listDirs.reverse()
+-        for dirnode in listDirs:
+-            try:
+-                # Don't call dirnode.build(), call the base Node method
+-                # directly because we definitely *must* create this
+-                # directory.  The dirnode.build() method will suppress
+-                # the build if it's the default builder.
+-                SCons.Node.Node.build(dirnode)
+-                dirnode.get_executor().nullify()
+-                # The build() action may or may not have actually
+-                # created the directory, depending on whether the -n
+-                # option was used or not.  Delete the _exists and
+-                # _rexists attributes so they can be reevaluated.
+-                dirnode.clear()
+-            except OSError:
+-                pass
++        self.dir._create()
+ 
+     def retrieve_from_cache(self):
+         """Try to retrieve the node's content from a cache
+@@ -1844,7 +1876,7 @@
+ 
+ default_fs = FS()
+ 
+-def find_file(filename, paths, node_factory=default_fs.File, verbose=None):
++def find_file(filename, paths, verbose=None):
+     """
+     find_file(str, [Dir()]) -> [nodes]
+ 
+@@ -1860,6 +1892,7 @@
+ 
+     Only the first file found is returned, and none is returned
+     if no file is found.
++    __cacheable__
+     """
+     if verbose:
+         if not SCons.Util.is_String(verbose):
+@@ -1870,49 +1903,32 @@
+     else:
+         verbose = lambda x: x
+ 
+-    filedir, filename = os.path.split(filename)
+-    if filedir:
+-        lookup_dir = lambda d, fd=filedir: d.Dir(fd)
+-    else:
+-        lookup_dir = lambda d: d
+-
+     if callable(paths):
+         paths = paths()
+ 
+     # Give Entries a chance to morph into Dirs.
+     paths = map(lambda p: p.must_be_a_Dir(), paths)
+ 
+-    for pathdir in paths:
+-        verbose("looking for '%s' in '%s' ...\n" % (filename, pathdir))
+-        dir = lookup_dir(pathdir)
+-        def func(node):
+-            if isinstance(node, SCons.Node.FS.File) and \
+-               (node.is_derived() or node.is_pseudo_derived() or node.exists()):
+-                    return node
+-            return None
+-
+-        node = default_fs.do_Rsearch(filename, func, File, dir, verbose)
++    filedir, filename = os.path.split(filename)
++    if filedir:
++        def filedir_lookup(p, fd=filedir):
++            try:
++                return p.Dir(fd)
++            except TypeError:
++                # We tried to look up a Dir, but it seems there's already
++                # a File (or something else) there.  No big.
++                return None
++        paths = filter(None, map(filedir_lookup, paths))
++
++    for dir in paths:
++        verbose("looking for '%s' in '%s' ...\n" % (filename, dir))
++        node, d = dir.srcdir_find_file(filename)
+         if node:
++            verbose("... FOUND '%s' in '%s'\n" % (filename, d))
+             return node
+-
+-        dirname = '.'
+-        while dir:
+-            if dir.srcdir:
+-                d = dir.srcdir.Dir(dirname)
+-                if d.is_under(dir):
+-                    # Shouldn't source from something in the build path:
+-                    # build_dir is probably under src_dir, in which case
+-                    # we are reflecting.
+-                    break
+-                node = dir.fs.do_Rsearch(filename, func, File, d, verbose)
+-                if node:
+-                    return File(filename, dir.Dir(dirname), dir.fs)
+-            dirname = dir.name + os.sep + dirname
+-            dir = dir.get_dir()
+-
+     return None
+ 
+-def find_files(filenames, paths, node_factory = default_fs.File):
++def find_files(filenames, paths):
+     """
+     find_files([str], [Dir()]) -> [nodes]
+ 
+@@ -1927,7 +1943,5 @@
+     Only the first file found is returned for each filename,
+     and any files that aren't found are ignored.
+     """
+-    nodes = map(lambda x, paths=paths, node_factory=node_factory:
+-                       find_file(x, paths, node_factory),
+-                filenames)
+-    return filter(lambda x: x != None, nodes)
++    nodes = map(lambda x, paths=paths: find_file(x, paths), filenames)
++    return filter(None, nodes)
diff -rNu devel/scons/files/patch-scanner-D.py devel/scons.new/files/patch-scanner-D.py
--- devel/scons/files/patch-scanner-D.py	Thu Jan  1 01:00:00 1970
+++ devel/scons.new/files/patch-scanner-D.py	Sat Mar 19 23:43:52 2005
@@ -0,0 +1,11 @@
+--- engine/SCons/Scanner/D.py.orig	Wed Feb 16 03:12:10 2005
++++ engine/SCons/Scanner/D.py	Tue Mar  1 22:00:50 2005
+@@ -51,7 +51,5 @@
+         # translate dots (package separators) to slashes
+         inc = string.replace(include, '.', '/')
+ 
+-        i = SCons.Node.FS.find_file(inc + '.d',
+-                                    (source_dir,) + path,
+-                                    self.fs.File)
++        i = SCons.Node.FS.find_file(inc + '.d', (source_dir,) + path)
+         return i, include
diff -rNu devel/scons/files/patch-scanner-Prog.py devel/scons.new/files/patch-scanner-Prog.py
--- devel/scons/files/patch-scanner-Prog.py	Thu Jan  1 01:00:00 1970
+++ devel/scons.new/files/patch-scanner-Prog.py	Sat Mar 19 23:44:10 2005
@@ -0,0 +1,11 @@
+--- engine/SCons/Scanner/Prog.py.orig	Wed Feb 16 03:12:11 2005
++++ engine/SCons/Scanner/Prog.py	Tue Mar  1 22:00:50 2005
+@@ -89,7 +89,7 @@
+             lib = env.subst(lib)
+             for pref, suf in pairs:
+                 l = adjustixes(lib, pref, suf)
+-                l = find_file(l, libpath, fs.File, verbose=print_find_libs)
++                l = find_file(l, libpath, verbose=print_find_libs)
+                 if l:
+                     result.append(l)
+         else:
diff -rNu devel/scons/files/patch-scanner-__init__.py devel/scons.new/files/patch-scanner-__init__.py
--- devel/scons/files/patch-scanner-__init__.py	Thu Jan  1 01:00:00 1970
+++ devel/scons.new/files/patch-scanner-__init__.py	Sat Mar 19 23:44:44 2005
@@ -0,0 +1,24 @@
+--- engine/SCons/Scanner/__init__.py.orig	Wed Feb 16 03:12:10 2005
++++ engine/SCons/Scanner/__init__.py	Tue Mar  1 22:00:50 2005
+@@ -338,9 +338,7 @@
+     def find_include(self, include, source_dir, path):
+         "__cacheable__"
+         if callable(path): path = path()
+-        n = SCons.Node.FS.find_file(include,
+-                                    (source_dir,) + tuple(path),
+-                                    SCons.Node.FS.File)
++        n = SCons.Node.FS.find_file(include, (source_dir,) + tuple(path))
+         return n, include
+ 
+     def sort_key(self, include):
+@@ -398,9 +396,7 @@
+         else:
+             paths = Binder( tuple(path) + (source_dir,) )
+ 
+-        n = SCons.Node.FS.find_file(include[1],
+-                                    paths,
+-                                    self.fs.File)
++        n = SCons.Node.FS.find_file(include[1], paths)
+ 
+         return n, include[1]
+ 
diff -rNu devel/scons/files/patch-script-Main.py devel/scons.new/files/patch-script-Main.py
--- devel/scons/files/patch-script-Main.py	Thu Jan  1 01:00:00 1970
+++ devel/scons.new/files/patch-script-Main.py	Sun Mar 20 00:37:34 2005
@@ -0,0 +1,11 @@
+--- engine/SCons/Script/Main.py.orig	Wed Feb 16 03:12:11 2005
++++ engine/SCons/Script/Main.py	Sat Mar 19 23:40:24 2005
+@@ -1024,7 +1034,7 @@
+                 node = None
+         return node
+ 
+-    nodes = filter(lambda x: x is not None, map(Entry, targets))
++    nodes = filter(None, map(Entry, targets))
+ 
+     task_class = BuildTask	# default action is to build targets
+     opening_message = "Building targets ..."
diff -rNu devel/scons/files/patch-script-SConscript.py devel/scons.new/files/patch-script-SConscript.py
--- devel/scons/files/patch-script-SConscript.py	Thu Jan  1 01:00:00 1970
+++ devel/scons.new/files/patch-script-SConscript.py	Sat Mar 19 23:47:07 2005
@@ -0,0 +1,30 @@
+--- engine/SCons/Script/SConscript.py.orig	Wed Feb 16 03:12:11 2005
++++ engine/SCons/Script/SConscript.py	Thu Mar 17 14:07:00 2005
+@@ -55,6 +55,16 @@
+ import types
+ import UserList
+ 
++# The following variables used to live in this module.  Some
++# SConscript files out there may have referred to them directly as
++# SCons.Script.SConscript.*.  This is now supported by some special
++# handling towards the bottom of the SConscript.__init__.py module.
++#Arguments = {}
++#ArgList = []
++#BuildTargets = TargetList()
++#CommandLineTargets = []
++#DefaultTargets = []
++
+ launch_dir = os.path.abspath(os.curdir)
+ 
+ GlobalDict = None
+@@ -230,7 +240,9 @@
+                 # Repository directory.  Like above, we do this
+                 # directly.
+                 fs.chdir(frame.prev_dir, change_os_dir=0)
+-                os.chdir(frame.prev_dir.rdir().get_abspath())
++                rdir = frame.prev_dir.rdir()
++                rdir._create()  # Make sure there's a directory there.
++                os.chdir(rdir.get_abspath())
+ 
+             results.append(frame.retval)
+ 
diff -rNu devel/scons/files/patch-script-__init__.py devel/scons.new/files/patch-script-__init__.py
--- devel/scons/files/patch-script-__init__.py	Thu Jan  1 01:00:00 1970
+++ devel/scons.new/files/patch-script-__init__.py	Sat Mar 19 23:47:46 2005
@@ -0,0 +1,84 @@
+--- engine/SCons/Script/__init__.py.orig	Wed Feb 16 03:12:11 2005
++++ engine/SCons/Script/__init__.py	Thu Mar 17 14:07:01 2005
+@@ -77,6 +77,41 @@
+ 
+ main                    = Main.main
+ 
++# The following are global class definitions and variables that used to
++# live directly in this module back before 0.96.90, when it contained
++# a lot of code.  Some SConscript files in widely-distributed packages
++# (Blender is the specific example) actually reached into SCons.Script
++# directly to use some of these.  Rather than break those SConscript
++# files, we're going to propagate these names into the SCons.Script
++# namespace here.
++#
++# Some of these are commented out because it's *really* unlikely anyone
++# used them, but we're going to leave the comment here to try to make
++# it obvious what to do if the situation arises.
++BuildTask               = Main.BuildTask
++CleanTask               = Main.CleanTask
++QuestionTask            = Main.QuestionTask
++#PrintHelp               = Main.PrintHelp
++OptParser               = Main.OptParser
++SConscriptSettableOptions = Main.SConscriptSettableOptions
++
++keep_going_on_error     = Main.keep_going_on_error
++print_dtree             = Main.print_dtree
++print_explanations      = Main.print_explanations
++print_includes          = Main.print_includes
++print_objects           = Main.print_objects
++print_time              = Main.print_time
++print_tree              = Main.print_tree
++memory_stats            = Main.memory_stats
++ignore_errors           = Main.ignore_errors
++#sconscript_time         = Main.sconscript_time
++#command_time            = Main.command_time
++#exit_status             = Main.exit_status
++#profiling               = Main.profiling
++repositories            = Main.repositories
++#num_jobs                = Main.num_jobs     # settable by SConscript.SetJobs()
++
++#
+ import SConscript
+ _SConscript = SConscript
+ 
+@@ -206,7 +241,7 @@
+     'GetOption',
+     'Help',
+     'Import',
+-    'SConscript',
++    #'SConscript', is handled separately, below.
+     'SConscriptChdir',
+     'SetOption',
+ 
+@@ -221,6 +256,7 @@
+     #The Command() method is handled separately, below.
+     'Depends',
+     'Dir',
++    'Entry',
+     'Execute',
+     'File',
+     'FindFile',
+@@ -272,6 +308,22 @@
+ 
+ for name in GlobalDefaultEnvironmentFunctions + GlobalDefaultBuilders:
+     exec "%s = _SConscript.DefaultEnvironmentCall(%s)" % (name, repr(name))
++
++# There are a handful of variables that used to live in the
++# Script/SConscript.py module that some SConscript files out there were
++# accessing directly as SCons.Script.SConscript.*.  The problem is that
++# "SConscript" in this namespace is no longer a module, it's a global
++# function call--or more precisely, an object that implements a global
++# function call through the default Environment.  Nevertheless, we can
++# aintain backwards compatibility for SConscripts that were reaching in
++# this way by hanging some attributes off the "SConscript" object here.
++SConscript = _SConscript.DefaultEnvironmentCall('SConscript')
++
++SConscript.Arguments = ARGUMENTS
++SConscript.ArgList = ARGLIST
++SConscript.BuildTargets = BUILD_TARGETS
++SConscript.CommandLineTargets = COMMAND_LINE_TARGETS
++SConscript.DefaultTargets = DEFAULT_TARGETS
+ 
+ # The global Command() function must be handled differently than the
+ # global functions for other construction environment methods because

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list