[Scons-users] Creating a class in a SConscript

Dynastic Space dynasticspace at gmail.com
Thu May 4 16:44:51 EDT 2017


I wasn't sure those will be accepted...

On Thu, May 4, 2017 at 11:26 PM, Bill Deegan <bill at baddogconsulting.com>
wrote:

> how about a zip file or a tar gzip? Make it easier on us..
>
> On Thu, May 4, 2017 at 3:48 PM, Dynastic Space <dynasticspace at gmail.com>
> wrote:
>
>> Attaching files here.
>>
>> I obfuscated my directory structure, but I am sure you can reconstitute
>> it. In the 'project' directory there is an empty __init__.py file just to
>> satisfy python. gmail does not let me attach it here.
>>
>> The output I get is:
>>
>>  scons
>> scons: Reading SConscript files ...
>> isinstance(d, B) = True
>> PrintIsInstance called from SConstruct, type <class 'SCons.Script.D'>,
>> isinstance: True, hierarchy (<class 'SCons.Script.D'>, <class
>> 'my_script.C'>, <class 'my_script.B'>, <class 'my_script.A'>, <type
>> 'object'>)
>> PrintIsInstance called from SConstruct, type <class 'SCons.Script.D'>,
>> isinstance: False, hierarchy (<class 'SCons.Script.D'>, <class
>> 'my_script.C'>, <class 'my_script.B'>, <class 'my_script.A'>, <type
>> 'object'>)
>> scons: done reading SConscript files.
>> scons: Building targets ...
>> scons: `.' is up to date.
>> scons: done building targets.
>>
>> Thanks for the quick response.
>>
>> Howling
>>
>>
>> On Thu, May 4, 2017 at 10:14 PM, Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>> Can you provide a small complete example? (A SConstruct which
>>> demonstrate this?)
>>>
>>> On Thu, May 4, 2017 at 3:05 PM, Dynastic Space <dynasticspace at gmail.com>
>>> wrote:
>>>
>>>> I have a python script defining a hierarchy of classes. This script is
>>>> not part of the scons environment.
>>>>
>>>> In a SConscript file I derive from one of the classes defined in my
>>>> script.
>>>>
>>>> I store an instance of the new class in the environment, to access it
>>>> later in my script.
>>>> However, when I use isinstance(instance, MyParentClass) it returns
>>>> False.
>>>>
>>>> See the following print:
>>>> binary: app type: <class 'SCons.Script.MyAppBinaryDesc'> instance of
>>>> AppBinaryDesc: False hierarchy: (<class 'SCons.Script.MyBinaryDesc'>,
>>>> <class 'binary_descriptor.SPAppBinaryDesc'>, <class
>>>> 'binary_descriptor.AppBinaryDesc'>, <class
>>>> 'binary_descriptor.BuildableDesc'>, <class
>>>> 'binary_descriptor.BinaryDesc'>, <type 'object'>)
>>>>
>>>> The instantiated object is app.
>>>> The class that was instantiated in my SConscript is MyAppBinaryDesc.
>>>> I use isinstance(app, AppBinaryDesc) which returns False.
>>>>
>>>> I expect it to return 'True', as the hierarchy clearly shows
>>>> MyAppBinaryDesc inheriting from AppBinaryDesc.
>>>>
>>>> I tried importing SCons.Script in my script, but that did not help.
>>>>
>>>> Thanks,
>>>>
>>>> Howling
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170504/10352d3f/attachment.html>


More information about the Scons-users mailing list