Sheribaby / swtoolkit

Automatically exported from code.google.com/p/swtoolkit
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

replicate.py compares SConsNode.FS.Dir by string comparison and fails wrongly on Fedora, Python2.7 #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Anytime I attempt to env.Replicate( '/tmp/target_dir', [ 'a_dir' ] ) the 
directory is not recognized as a directory and the directory is not recursively 
copied.

This appears to be caused by a comparison on replicate.py:96:
    if ( str(s.__class__) == 'SCons.Node.FS.Dir':

Putting a print "print str(s.__class__)" produces an alternate class string 
format, "<class 'SCons.Node.FS.File'>", and the comparison fails.

Changing the line to:
    if ( str(s.__class__) == 'SCons.Node.FS.Dir' or SCons.Node.FS.Dir == s.__class__ ):

appears to resolve the problem. Also, "include SCons" must be added to the head 
of the file.

This occurs with version 0.9.1 on Fedora 15, Python 2.7.1.

As added information, if I create a class in the raw python interpreter the 
normal class naming is returned, implying something is altering the str(...) 
behavior of classes.

    Python 2.7.1 (r271:86832, Apr 12 2011, 16:15:16) 
    [GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> class A:
    ...     pass
    ... 
    >>> print str(A().__class__)
    __main__.A

Patch for replicate.py attached.

Original issue reported on code.google.com by balsalig...@gmail.com on 18 Jul 2011 at 4:18

Attachments: