{"thread":{"id":"46107","subject":"[PATCH] git-p4: remove obsolete version check","startedAt":"2017-06-03T15:57:18Z","lastAt":"2017-06-04T18:45:48Z","messageCount":3,"participants":["Jakub Wilk","Ævar Arnfjörð Bjarmason","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"321480","messageId":"20170603133120.715-1-jwilk@jwilk.net","threadId":"46107","inReplyTo":null,"subject":"[PATCH] git-p4: remove obsolete version check","fromName":"Jakub Wilk","fromEmail":"jwilk@jwilk.net","sentAt":"2017-06-03T13:31:20Z","receivedAt":"2017-06-03T15:57:18Z","isPatch":true,"sender":{"key":"jwilk@jwilk.net","avatar":"https://avatars.githubusercontent.com/u/141546?v=4"},"body":"The file is syntactically correct only in Python >= 2.6, so the\nversion check never does anything.\n\nSigned-off-by: Jakub Wilk <jwilk@jwilk.net>\n---\n git-p4.py | 4 ----\n 1 file changed, 4 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 8d151da91..4278cd9d4 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -8,10 +8,6 @@\n # License: MIT <http://www.opensource.org/licenses/mit-license.php>\n #\n import sys\n-if sys.hexversion < 0x02040000:\n-    # The limiter is the subprocess module\n-    sys.stderr.write(\"git-p4: requires Python 2.4 or later.\\n\")\n-    sys.exit(1)\n import os\n import optparse\n import marshal\n-- \n2.13.0.506.g27d5fe0cd\n\n"},{"id":"321483","messageId":"CACBZZX7Sz6VPLQgzyQ1Dk+-899y0NzqMjVYL5ry0n-0axmR35w@mail.gmail.com","threadId":"46107","inReplyTo":"20170603133120.715-1-jwilk@jwilk.net","subject":"Re: [PATCH] git-p4: remove obsolete version check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-06-03T16:55:22Z","receivedAt":"2017-06-03T16:55:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sat, Jun 3, 2017 at 3:31 PM, Jakub Wilk <jwilk@jwilk.net> wrote:\n> The file is syntactically correct only in Python >= 2.6, so the\n> version check never does anything.\n\n[CC-ing Eric who added that check]\n\nYour commit message doesn't give an example of this, but with e.g.\npython 2.0 you get:\n\n      File \"git-p4.py\", line 469\n        yield pattern\n                ^\n    SyntaxError: invalid syntax\n\nI checked the various other python files that had similar warnings,\nthey all work correctly with python 2.0.\n\nOne workaround to keep this would be to make git-p4.py import some\nlibrary to do all its work, and use some subset of python syntax to\njust load and defer to that library. That works for me when I change\nit like that locally. Alternatively, does Python have something like\nPerl's BEGIN {} blocks where you can execute code right there before\nthe file has finished parsing?\n\nOr we could just remove this, just wanted to note the above since I\ndug into it, and the commit message light on details.\n\n\n\n> Signed-off-by: Jakub Wilk <jwilk@jwilk.net>\n> ---\n>  git-p4.py | 4 ----\n>  1 file changed, 4 deletions(-)\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index 8d151da91..4278cd9d4 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -8,10 +8,6 @@\n>  # License: MIT <http://www.opensource.org/licenses/mit-license.php>\n>  #\n>  import sys\n> -if sys.hexversion < 0x02040000:\n> -    # The limiter is the subprocess module\n> -    sys.stderr.write(\"git-p4: requires Python 2.4 or later.\\n\")\n> -    sys.exit(1)\n>  import os\n>  import optparse\n>  import marshal\n> --\n> 2.13.0.506.g27d5fe0cd\n>\n"},{"id":"321512","messageId":"20170604184533.ztsmvbinfytrhl4x@genre.crustytoothpaste.net","threadId":"46107","inReplyTo":"CACBZZX7Sz6VPLQgzyQ1Dk+-899y0NzqMjVYL5ry0n-0axmR35w@mail.gmail.com","subject":"Re: [PATCH] git-p4: remove obsolete version check","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-06-04T18:45:34Z","receivedAt":"2017-06-04T18:45:48Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sat, Jun 03, 2017 at 06:55:22PM +0200, Ævar Arnfjörð Bjarmason wrote:\n> On Sat, Jun 3, 2017 at 3:31 PM, Jakub Wilk <jwilk@jwilk.net> wrote:\n> > The file is syntactically correct only in Python >= 2.6, so the\n> > version check never does anything.\n> \n> [CC-ing Eric who added that check]\n> \n> Your commit message doesn't give an example of this, but with e.g.\n> python 2.0 you get:\n> \n>       File \"git-p4.py\", line 469\n>         yield pattern\n>                 ^\n>     SyntaxError: invalid syntax\n> \n> I checked the various other python files that had similar warnings,\n> they all work correctly with python 2.0.\n\nThe yield syntax was in Python 2.3, so this isn't indicative of the\nproblem.  You'd actually need to test with 2.5 itself in order to know\nwhat that version complains about.\n\n> One workaround to keep this would be to make git-p4.py import some\n> library to do all its work, and use some subset of python syntax to\n> just load and defer to that library. That works for me when I change\n> it like that locally. Alternatively, does Python have something like\n> Perl's BEGIN {} blocks where you can execute code right there before\n> the file has finished parsing?\n\nTTBOMK, Python doesn't have such functionality.\n\n> Or we could just remove this, just wanted to note the above since I\n> dug into it, and the commit message light on details.\n\nAs a note, Python 2.6 has been around since at least 2009, so I think\nit's fine to drop support for earlier versions at this point.  But I\nagree an explanation in the commit message of what exactly makes it\nsyntactically invalid would be beneficial.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"}]}