Bug 102852

Summary: Scons: Support the new Scons 3.0.0
Product: Mesa Reporter: pal1000 <liviuprodea>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=100202
Whiteboard:
i915 platform: i915 features:
Attachments: Scons 3.0.0 compatibility patch

Description pal1000 2017-09-19 08:41:34 UTC
Scons 3.0.0 is out with Visual Studio 2017 support and other enhancements:

https://raw.githubusercontent.com/SConsProject/scons/rel_3.0.0/src/CHANGES.txt

I jumped to update considering it would reduce my build environment size by > 2GB (the size occupied by Visual Studio 2015 Update 3 toolset which is required to make Scons 2.5.1 aware of Visual Studio 2017 - per bug 100202 comment 2 1st sentence). Unfortunately this didn't work smoothly, Mesa Sconstruct and possibly some sconscripts are not compatible:

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26730.15
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_x86'

scons: Reading SConscript files ...
  File "C:\Software\DEVELO~1\projects\mesa\mesa\SConstruct", line 53

    print 'scons: warning: targets option is deprecated; pass the targets on their own such as'

                                                                                              ^

SyntaxError: invalid syntax
Comment 1 Eric Engestrom 2017-09-19 10:13:55 UTC
This feels like a python2 vs python3 compatibility issue (`print 'foo'` instead of `printf('foo')`).
Can you set your environment to use python2? I expect that will solve the issue.
Comment 2 pal1000 2017-09-19 10:43:14 UTC
I always used Python 2.7. I always knew Mesa3D Scons build isn't Python 3 compatible. So there is a push towards Python 3 by Scons 3.0 apparently.
Comment 3 pal1000 2017-09-19 20:13:28 UTC
Created attachment 134347 [details] [review]
Scons 3.0.0 compatibility patch

Fixing this turned out to be very straight forward.
Scons 3.0.0 wants print called like functions, so replacing 
print '...' and print "..." everywhere with print ('...') and print ("...") respectively did the trick. I checked with Scons 2.5.1 and it recognizes this new format, so there is no breakage with previous Scons release.

I used the Everything advanced search utility to make sure I don't miss any 
print '...' and print "..." unconverted.

I know, this patch is large, exceeding the recommended size. It could be split in 6 parts, one for each touched file.
Comment 4 Eric Engestrom 2017-09-20 09:53:38 UTC
(In reply to Alex Granni from comment #3)
> Created attachment 134347 [details] [review] [review]
> Scons 3.0.0 compatibility patch

I sent the same patch (and more) on the list yesterday afternoon, a few hours before your message:
https://lists.freedesktop.org/archives/mesa-dev/2017-September/170124.html

I cc'ed you on the email you registered on bugzilla, did you not get it?
Comment 5 pal1000 2017-09-26 07:40:11 UTC
 Eric Engestrom py2/3 compatibility patch series landed in Mesa master yesterday.
The first patch in the series address this issue so I am closing this.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.