From mboxrd@z Thu Jan 1 00:00:00 1970 From: Masahiro Yamada Date: Mon, 04 Aug 2014 21:00:46 +0900 Subject: [U-Boot] [RFC PATCH v2 0/2] Make Python scripts compatible with older versions In-Reply-To: <53DF6CBC.8040701@compulab.co.il> References: <1407147794-32066-1-git-send-email-yamada.m@jp.panasonic.com> <53DF6CBC.8040701@compulab.co.il> Message-ID: <20140804210046.D55A.AA925319@jp.panasonic.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Igor, On Mon, 04 Aug 2014 14:21:32 +0300 Igor Grinberg wrote: > Hi Masahiro, > > > On 08/04/14 13:23, Masahiro Yamada wrote: > > > > It was reported by Miao Yan that the kconfig-related Python scripts > > are not working on Python 2.4. > > > > Do we have any consensus in terms of Python version requirement? > > > > This series avoids using "with ... as ..." and "except ... as ..." > > statements. But "with ... as ..." is used everywhere in buildman, > > which means buildman requires at least Python 2.6. > > Hmmmm.... Funny... a bit more fire: > > -------------------cut---------------------------- > $ make cm_t335_defconfig > HOSTCC scripts/basic/fixdep > GEN /home/grinberg/bin-temp/u-boot/Makefile > File "/home/grinberg/git-repo/u-boot/scripts/multiconfig.py", line 344 > print "*** Default configuration is based on '%s'" % KBUILD_DEFCONFIG > ^ > SyntaxError: invalid syntax > make[1]: *** [cm_t335_defconfig] Error 1 > make: *** [sub-make] Error 2 > > $ python --version > Python 3.3.5 > -------------------cut---------------------------- Sorry, the script does not work on 3.x I think make PYTHON=python2 cm_t335_defconfig will work if Python 2.x exists as "python2" in your command path. > Apparently, print should be used as function - with parenthesis... Yes, a famous difference between 2.x and 3.x "print" is a statement in 2.x but a function in 3.x. At first, when I was writing tools/genboardscfg.py, I tried to make it compatible with both 2.x and 3.x. But I found it was more difficult than I had expected because of the varous differences. Finially I gave up. As for scripts/multiconfig.py, perhaps I can modify it for 3.x compatible. > It seems that those scripts only work on Python versions 2.6 - 2.7? Yes. > > It is true we hope tools can work on broad range of versions, > > but it also means we have more restrictions when writing Python scripts. > > > > I have no idea which version we should expect at least. > > Your comments are welcome. > > I'd propose to not bring any new dependency on python at all... > At least not for the simple task of building U-Boot... > Can't we use a bit more stable API then this of python? Yeah, some people want to run it on older version such as 2.4.x and some people want to use Python 3.x. Now I found it so difficult to satisfy everyone. Maybe I made a mistake in the first place. Best Regards Masahiro Yamada