Issue 20 in swtoolkit: replicate.py compares SConsNode.FS.Dir by string comparison and fails wrongly on Fedora, Python2.7

8 views
Skip to first unread message

codesite...@google.com

unread,
Jul 18, 2011, 12:19:01 PM7/18/11
to swto...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 20 by balsalig...@gmail.com: replicate.py compares
SConsNode.FS.Dir by string comparison and fails wrongly on Fedora, Python2.7
http://code.google.com/p/swtoolkit/issues/detail?id=20

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.

Attachments:
replicate.patch 780 bytes

Reply all
Reply to author
Forward
0 new messages