* [PATCH] git-p4: remove obsolete version check @ 2017-06-03 13:31 Jakub Wilk 2017-06-03 16:55 ` Ævar Arnfjörð Bjarmason 0 siblings, 1 reply; 3+ messages in thread From: Jakub Wilk @ 2017-06-03 13:31 UTC (permalink / raw) To: git; +Cc: Luke Diamand The file is syntactically correct only in Python >= 2.6, so the version check never does anything. Signed-off-by: Jakub Wilk <jwilk@jwilk.net> --- git-p4.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/git-p4.py b/git-p4.py index 8d151da91..4278cd9d4 100755 --- a/git-p4.py +++ b/git-p4.py @@ -8,10 +8,6 @@ # License: MIT <http://www.opensource.org/licenses/mit-license.php> # import sys -if sys.hexversion < 0x02040000: - # The limiter is the subprocess module - sys.stderr.write("git-p4: requires Python 2.4 or later.\n") - sys.exit(1) import os import optparse import marshal -- 2.13.0.506.g27d5fe0cd ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] git-p4: remove obsolete version check 2017-06-03 13:31 [PATCH] git-p4: remove obsolete version check Jakub Wilk @ 2017-06-03 16:55 ` Ævar Arnfjörð Bjarmason 2017-06-04 18:45 ` brian m. carlson 0 siblings, 1 reply; 3+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2017-06-03 16:55 UTC (permalink / raw) To: Jakub Wilk; +Cc: Git Mailing List, Luke Diamand, Eric S. Raymond On Sat, Jun 3, 2017 at 3:31 PM, Jakub Wilk <jwilk@jwilk.net> wrote: > The file is syntactically correct only in Python >= 2.6, so the > version check never does anything. [CC-ing Eric who added that check] Your commit message doesn't give an example of this, but with e.g. python 2.0 you get: File "git-p4.py", line 469 yield pattern ^ SyntaxError: invalid syntax I checked the various other python files that had similar warnings, they all work correctly with python 2.0. One workaround to keep this would be to make git-p4.py import some library to do all its work, and use some subset of python syntax to just load and defer to that library. That works for me when I change it like that locally. Alternatively, does Python have something like Perl's BEGIN {} blocks where you can execute code right there before the file has finished parsing? Or we could just remove this, just wanted to note the above since I dug into it, and the commit message light on details. > Signed-off-by: Jakub Wilk <jwilk@jwilk.net> > --- > git-p4.py | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/git-p4.py b/git-p4.py > index 8d151da91..4278cd9d4 100755 > --- a/git-p4.py > +++ b/git-p4.py > @@ -8,10 +8,6 @@ > # License: MIT <http://www.opensource.org/licenses/mit-license.php> > # > import sys > -if sys.hexversion < 0x02040000: > - # The limiter is the subprocess module > - sys.stderr.write("git-p4: requires Python 2.4 or later.\n") > - sys.exit(1) > import os > import optparse > import marshal > -- > 2.13.0.506.g27d5fe0cd > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] git-p4: remove obsolete version check 2017-06-03 16:55 ` Ævar Arnfjörð Bjarmason @ 2017-06-04 18:45 ` brian m. carlson 0 siblings, 0 replies; 3+ messages in thread From: brian m. carlson @ 2017-06-04 18:45 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason Cc: Jakub Wilk, Git Mailing List, Luke Diamand, Eric S. Raymond [-- Attachment #1: Type: text/plain, Size: 1802 bytes --] On Sat, Jun 03, 2017 at 06:55:22PM +0200, Ævar Arnfjörð Bjarmason wrote: > On Sat, Jun 3, 2017 at 3:31 PM, Jakub Wilk <jwilk@jwilk.net> wrote: > > The file is syntactically correct only in Python >= 2.6, so the > > version check never does anything. > > [CC-ing Eric who added that check] > > Your commit message doesn't give an example of this, but with e.g. > python 2.0 you get: > > File "git-p4.py", line 469 > yield pattern > ^ > SyntaxError: invalid syntax > > I checked the various other python files that had similar warnings, > they all work correctly with python 2.0. The yield syntax was in Python 2.3, so this isn't indicative of the problem. You'd actually need to test with 2.5 itself in order to know what that version complains about. > One workaround to keep this would be to make git-p4.py import some > library to do all its work, and use some subset of python syntax to > just load and defer to that library. That works for me when I change > it like that locally. Alternatively, does Python have something like > Perl's BEGIN {} blocks where you can execute code right there before > the file has finished parsing? TTBOMK, Python doesn't have such functionality. > Or we could just remove this, just wanted to note the above since I > dug into it, and the commit message light on details. As a note, Python 2.6 has been around since at least 2009, so I think it's fine to drop support for earlier versions at this point. But I agree an explanation in the commit message of what exactly makes it syntactically invalid would be beneficial. -- brian m. carlson / brian with sandals: Houston, Texas, US https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 868 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-04 18:45 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-06-03 13:31 [PATCH] git-p4: remove obsolete version check Jakub Wilk 2017-06-03 16:55 ` Ævar Arnfjörð Bjarmason 2017-06-04 18:45 ` brian m. carlson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).