Re: [Scons-dev] SCons and octal constants
Hi Bill, On 30.04.2014 00:33, Bill Deegan wrote: All, If someone can point me to a pylint command line which should work for scons repo, I can add it to buildbot. the fix to "astroid" seems to be working fine. I installed the latest version of pylint: logilab_common 0.61.0 astroid 1.1.1 pylint 1.2.1 (each installed from latest revision of their repositories, so I'm not sure the version numbers are correct). Then, in the top-level of the SCons repository you can call PYTHONPATH=src/engine pylint src/engine/SCons and pylint runs through to the end. We might want to setup a customized config file, for getting rid of all those annoying "invalid variable name" messages...but just try to get it working on your side for now. Regards, Dirk ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
All, If someone can point me to a pylint command line which should work for scons repo, I can add it to buildbot. -Bill On Mon, Apr 28, 2014 at 9:04 AM, Dirk Bächle wrote: > Hi, > > > On 28.04.2014 09:19, anatoly techtonik wrote: > >> On Mon, Apr 28, 2014 at 8:48 AM, Russel Winder >> wrote: >> >>> Since the floor version of SCons is now Python 2.7, we should dispense >>> with the horror that is 1970s C-style octal constants and use the 0o >>> form (*). This applies to the default/default branch just as much to the >>> default/python3-port branch (where it is needed for SCons to run at all >>> on Python 3). >>> >>> If making this change is agreed then I guess there needs to be a single >>> changeset alteration proposed to both branches. I am assuming we do this >>> on one branch and then cherry-pick into the other. This would imply >>> doing it for the default/default branch and then cherry-picking into >>> default/python3-port. >>> >>> Thanks. >>> >>> (*) The 0o form works in Python 2.6 as well. >>> >> Let me sum this up. To make SCons codebase more 2/3 compatible, we >> need to use 0o777 instead of 0777. >> >> +1 >> >> Do you need help preparing PR? >> BTW, does anybody know a tool to grep Python AST for that? >> Maybe pylint with a single rule can do all the job automatically? >> Would be nice to see the command here for reference. >> > > some while ago I had filed the issue > > https://bitbucket.org/logilab/astroid/issue/17/typeerror- > due-to-definition-of-__call__ > > , which seems to be resolved now in "astroid". I didn't have any time to > try it out yet, but this should open the door to running the whole codebase > through "pylint"...and also "pyreverse" for creating UML diagrams of > classes automatically. Yummy... > > So pylint/astroid might indeed help with detecting all occurrences of > octal constants. > > Best regards, > > Dirk > > > ___ > Scons-dev mailing list > Scons-dev@scons.org > http://two.pairlist.net/mailman/listinfo/scons-dev > ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
On Tue, Apr 29, 2014 at 3:09 AM, anatoly techtonik wrote: > IMHO this is a start to nowhere. octals are not limited to file masks, > more than that - we need the recipe for users to help the port their > SConstruct files to Python 3. > This is a completely different thing. SCons itself needs to work in 2 and 3, and fixing octal constants (even if we don't get 100% of them in the first pass) is a good step toward that. Separately, some users will need help porting SConscripts, but that doesn't diminish the usefulness of this change. -- Gary ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
On Mon, Apr 28, 2014 at 7:49 PM, Russel Winder wrote: > On Mon, 2014-04-28 at 14:26 +0300, anatoly techtonik wrote: >> On Mon, Apr 28, 2014 at 10:52 AM, Russel Winder wrote: >> > >> > Actually I think it may be fairly straightforward using find, grep and >> > emacs. Although there are quite a lot of octal constants I think it can >> > be done fairly quickly as a single changeset. >> >> I am not sure how you would search for all numbers starting with 0 that >> are not part of strings with these tools. >> >> \b0[1-9] ? > > Given the code base, I suspect: > > \<0[0-7][0-7][0-7]\> > > will catch a great deal of them, with some false positives due to > timezones in ISO 8601 date-times; at least a start. IMHO this is a start to nowhere. octals are not limited to file masks, more than that - we need the recipe for users to help the port their SConstruct files to Python 3. So, a 2to3 reversing or an astroid solution would be a proper hack worthy of engineering degree. =) ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
On Mon, 2014-04-28 at 14:26 +0300, anatoly techtonik wrote: > On Mon, Apr 28, 2014 at 10:52 AM, Russel Winder wrote: > > > > Actually I think it may be fairly straightforward using find, grep and > > emacs. Although there are quite a lot of octal constants I think it can > > be done fairly quickly as a single changeset. > > I am not sure how you would search for all numbers starting with 0 that > are not part of strings with these tools. > > \b0[1-9] ? Given the code base, I suspect: \<0[0-7][0-7][0-7]\> will catch a great deal of them, with some false positives due to timezones in ISO 8601 date-times; at least a start. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
Hi, On 28.04.2014 09:19, anatoly techtonik wrote: On Mon, Apr 28, 2014 at 8:48 AM, Russel Winder wrote: Since the floor version of SCons is now Python 2.7, we should dispense with the horror that is 1970s C-style octal constants and use the 0o form (*). This applies to the default/default branch just as much to the default/python3-port branch (where it is needed for SCons to run at all on Python 3). If making this change is agreed then I guess there needs to be a single changeset alteration proposed to both branches. I am assuming we do this on one branch and then cherry-pick into the other. This would imply doing it for the default/default branch and then cherry-picking into default/python3-port. Thanks. (*) The 0o form works in Python 2.6 as well. Let me sum this up. To make SCons codebase more 2/3 compatible, we need to use 0o777 instead of 0777. +1 Do you need help preparing PR? BTW, does anybody know a tool to grep Python AST for that? Maybe pylint with a single rule can do all the job automatically? Would be nice to see the command here for reference. some while ago I had filed the issue https://bitbucket.org/logilab/astroid/issue/17/typeerror-due-to-definition-of-__call__ , which seems to be resolved now in "astroid". I didn't have any time to try it out yet, but this should open the door to running the whole codebase through "pylint"...and also "pyreverse" for creating UML diagrams of classes automatically. Yummy... So pylint/astroid might indeed help with detecting all occurrences of octal constants. Best regards, Dirk ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
On Mon, Apr 28, 2014 at 10:52 AM, Russel Winder wrote: > > Actually I think it may be fairly straightforward using find, grep and > emacs. Although there are quite a lot of octal constants I think it can > be done fairly quickly as a single changeset. I am not sure how you would search for all numbers starting with 0 that are not part of strings with these tools. \b0[1-9] ? ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
On Mon, 2014-04-28 at 10:19 +0300, anatoly techtonik wrote: […] > > Let me sum this up. To make SCons codebase more 2/3 compatible, we > need to use 0o777 instead of 0777. Spot on. The 0o777 form works in Python 2.6 and 2.7 as well as being necessary in Python 3.x (0777 is a syntax error in Python 3). > Do you need help preparing PR? Actually I think it may be fairly straightforward using find, grep and emacs. Although there are quite a lot of octal constants I think it can be done fairly quickly as a single changeset. I think the best strategy is to do this on the Python 2 default/default first and get that into place before seeing if the changeset can be applied on default/python3-port rather than having to do all the edits again. > BTW, does anybody know a tool to grep Python AST for that? > Maybe pylint with a single rule can do all the job automatically? > Would be nice to see the command here for reference. 'fraid not, I tend to do this sort of thing with find and grep. I must learn more about pylint though… -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
On Mon, Apr 28, 2014 at 8:48 AM, Russel Winder wrote: > Since the floor version of SCons is now Python 2.7, we should dispense > with the horror that is 1970s C-style octal constants and use the 0o > form (*). This applies to the default/default branch just as much to the > default/python3-port branch (where it is needed for SCons to run at all > on Python 3). > > If making this change is agreed then I guess there needs to be a single > changeset alteration proposed to both branches. I am assuming we do this > on one branch and then cherry-pick into the other. This would imply > doing it for the default/default branch and then cherry-picking into > default/python3-port. > > Thanks. > > (*) The 0o form works in Python 2.6 as well. Let me sum this up. To make SCons codebase more 2/3 compatible, we need to use 0o777 instead of 0777. +1 Do you need help preparing PR? BTW, does anybody know a tool to grep Python AST for that? Maybe pylint with a single rule can do all the job automatically? Would be nice to see the command here for reference. -- anatoly t. ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
Re: [Scons-dev] SCons and octal constants
On 28.04.2014 07:48, Russel Winder wrote: Since the floor version of SCons is now Python 2.7, we should dispense with the horror that is 1970s C-style octal constants and use the 0o form (*). This applies to the default/default branch just as much to the default/python3-port branch (where it is needed for SCons to run at all on Python 3). +1 from me. Dirk ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev
[Scons-dev] SCons and octal constants
Since the floor version of SCons is now Python 2.7, we should dispense with the horror that is 1970s C-style octal constants and use the 0o form (*). This applies to the default/default branch just as much to the default/python3-port branch (where it is needed for SCons to run at all on Python 3). If making this change is agreed then I guess there needs to be a single changeset alteration proposed to both branches. I am assuming we do this on one branch and then cherry-pick into the other. This would imply doing it for the default/default branch and then cherry-picking into default/python3-port. Thanks. (*) The 0o form works in Python 2.6 as well. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder ___ Scons-dev mailing list Scons-dev@scons.org http://two.pairlist.net/mailman/listinfo/scons-dev