|
I mentioned always using the latter form. It really depends on what the
default for commonEnvironment['X'] is initialized to in defining the
option, but one should always test against the default set for the option.
Values from the commandline, i.e.
scons X=0
come in as the string "0" for me, and not the number 0. So, when testing:
if commonEnvironment['X']:
even though the intention is to set it to false, the test believes that X is true, as python uses the number 0 to be false, and everything else to be true.
So, that is why I recommended that when testing against the
configuration options, one should test "if still set to the default
option" or "if not set to the default option" as that seems the best way
to me to ensure the desired result is achieved.
steven
gogins@pipeline.com wrote:
>Which test is correct?
>
>if commonEnvironment['X']:
>
>or --
>
>if commonEnvironment['X'] == 1:
>
>Original Message:
>-----------------
>From: jpff@codemist.co.uk
>Date: Mon, 13 Dec 2004 06:53:58 +0000
>To: csound-dev@eartha.mills.edu
>Subject: [CSOUND-DEV:5526] We have reverted
>
>
>I build with
>scons buildCsoundVST=0 generateTags=1 useJack=0 generateZip=0 usePortMIDI=1
>
>but it still generates a ZIP file. Looks like the dreaded "1 is not
>true" state has reappeared
>
>1017c1020
>< if not (commonEnvironment['generateZip']):
>---
>
>
>>if not (commonEnvironment['generateZip']==1):
>>
>>
>
>Can we have a more secure way of testing these things?
>
>==John ffitch
>
>
>--------------------------------------------------------------------
>mail2web - Check your email from the web at
>http://mail2web.com/ .
>
>
>
>
>
> |