I am unclear on what people are suggesting as fixes to the issue. However I 
believe we tweak the way we “load” the Sconstruct we can control which print 
logic is used when python 2.7 is used. I don’t believe there is any way to 
allow the “classic” python 2.7 print to work in python 3.

 

I think if we can allow user of python 2 and SCons to not have their files 
break, that is a win. When using python 3 the users will need to update the 
SConstruct print statements ( or use some API we might be able to add). With 
this python3 capable drop of SCons I believe we should allow people to migrate 
to the new print() api by injecting a print function when SCons is used in 
python2. Such as function would look something like:

 

# print prototype for python 2.7

def print(*lst,**kw):

                msg = list(map(str,lst))

msg = kw.get('sep',' ').join(msg) + kw.get('end','\n')

sys.stdout.write(msg)

 

This should allow users of python 2 to have everything work as expected, given 
them time to move to a python3 like print() function over time. The will be 
able with python2 to have print and print(). This should allow user time to 
migrate SConstructs for a safe move python 3 when they are ready.

 

Still think having an official API will be a good thing long term, however this 
should allow current users to not break. We have to remember that no one is 
using python3 at this time, so expecting Sconstuct to change to work in python 
3 is not unreasonable, given we don’t have API’s in SCons today to prevent 
that. Users still may want to SCons to add Api to make this easier. Such as 
case could happen with files. I know Steve Knight had said a number of times he 
wanted to SCons users to use the node File and Dir to do all file based actions 
for example. If that work had happened it could help as well with current 
builders that will break when moving to python3 because of changes needed in 
the API to load data as expected.

 

Just some thoughts, hope this might help

 

Jason

 

 

From: Scons-dev [mailto:scons-dev-boun...@scons.org] On Behalf Of Bill Deegan
Sent: Wednesday, May 25, 2016 1:08 PM
To: SCons developer list <scons-dev@scons.org>
Subject: Re: [Scons-dev] no more print statements in SConscripts?

 

Gary,

Yup. that's expected.

Not sure how to handle this gracefully (besides as Jason suggests some 
"official" messaging API for SCons, which also would require time for users to 
adjust to).

Out of curiosity, would 2to3 resolve the issues you ran into?

(In theory it should)

Other issues might bit chmod bitmasks (though not until they run via py3)

-Bill

 

On Wed, May 25, 2016 at 5:59 AM, Gary Oberbrunner <ga...@oberbrunner.com 
<mailto:ga...@oberbrunner.com> > wrote:

Hi folks; I know I've been out of the loop recently, lots going on. Great work 
getting the python 3 stuff in!

 

I did just try the default branch (with python2.7 on Windows) and I notice 
print statements (not the function, just the statement) in 
SConstructs/SConscripts are now syntax errors. This'll probably be a big change 
for users. Just FYI.


 

-- 

Gary


_______________________________________________
Scons-dev mailing list
Scons-dev@scons.org <mailto:Scons-dev@scons.org> 
https://pairlist2.pair.net/mailman/listinfo/scons-dev

 

_______________________________________________
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev

Reply via email to