Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-24 Thread Eric S. Raymond
Junio C Hamano :
> > Should I resubmit, or do you intend to fix these while merging?
> 
> I'd appreciate a re-roll, perhaps in a few days after the dust
> settles.

You'll get it.

It will take a little longer than it otherwise might have because I'm
in the middle of straightening out the mess around cvsps and git-cvsimport,
which is deeper and nastier than I realized.

It turns out that one of the options git-cvsimport depends on, -A, has
been broken (leading to incorrect conversions of branchy repos) since
2006 if not earlier; I'm removing it outright.

Thus, the version of git-cvsimport in the git-tree will die with an
error calling cvsps 3.x - but since what it was doing before was actually
mangling users' repositories this is no great loss.

I'm going to have to shoot the existing implementation of
git-cvsimport through the head and rewrite it. This won't be
difficult; I already have a proof-of-concept in 126 lines of Python,
which is a big improvement over the 1179 lines of Perl in the existing
version.  Most of the vanished bulk is CVS client code for fetching
logs and files, which is now done better and faster inside cvsps.
-- 
http://www.catb.org/~esr/";>Eric S. Raymond
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-24 Thread Junio C Hamano
"Eric S. Raymond"  writes:

> Pete Wyckoff :
>> e...@thyrsus.com wrote on Thu, 20 Dec 2012 09:13 -0500:
>>  ...
>> Many of your changes have these three problems; I just picked on
>> my favorite one.
>
> Should I resubmit, or do you intend to fix these while merging?

I'd appreciate a re-roll, perhaps in a few days after the dust
settles.

Thanks, both, for the patch and the review.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-24 Thread Eric S. Raymond
Pete Wyckoff :
> e...@thyrsus.com wrote on Thu, 20 Dec 2012 09:13 -0500:
> > diff --git a/git-p4.py b/git-p4.py
> > index 551aec9..ec060b4 100755
> > --- a/git-p4.py
> > +++ b/git-p4.py
> > @@ -12,6 +12,11 @@ import optparse, sys, os, marshal, subprocess, shelve
> >  import tempfile, getopt, os.path, time, platform
> >  import re, shutil
> >  
> > +if sys.hexversion < 0x0204:
> > +# The limiter is the subprocess module
> > +sys.stderr.write("git-p4.py: requires Python 2.4 or later.")
> > +sys.exit(1)
> > +
> >  verbose = False
> 
> If 2.3 does not have the subprocess module, this script will fail
> at the import, and not run your version test.

Yes, the import of subprocess should move to after the check.

> All the uses of sys.stderr.write() should probably include a
> newline.  Presumably you used write instead of print to avoid
> 2to3 differences.

That is correct.
 
> The name of this particular script, as users would type it, is
> "git p4"; no dash and no ".py".
> 
> Many of your changes have these three problems; I just picked on
> my favorite one.

Should I resubmit, or do you intend to fix these while merging?
 
> > diff --git a/git-remote-testgit.py b/git-remote-testgit.py
> > index 5f3ebd2..22d2eb6 100644
> > --- a/git-remote-testgit.py
> > +++ b/git-remote-testgit.py
> > @@ -31,6 +31,11 @@ from git_remote_helpers.git.exporter import GitExporter
> >  from git_remote_helpers.git.importer import GitImporter
> >  from git_remote_helpers.git.non_local import NonLocalGit
> >  
> > +if sys.hexversion < 0x01050200:
> > +# os.makedirs() is the limiter
> > +sys.stderr.write("git-remote-testgit.py: requires Python 1.5.2 or 
> > later.")
> > +sys.exit(1)
> > +
> 
> This one, though, is a bit of a lie because git_remote_helpers
> needs 2.4, and you add that version enforcement in the library.

Agreed. The goal here was simply to have the depedencies of the individual
scripts be clearly documented, and establish a practice for future
submitters to emulate.

> I assume what you're trying to do here is to make the
> version-related failures more explicit, rather than have users
> parse an ImportError traceback, e.g.

See above.  At least half the point is making our dependencies
explicit rather than implicit, so we can make better policy
decisions.

> But what about the high-end of the version range?  I'm pretty
> sure most of these scripts will throw syntax errors on >= 3.0,
> how should we catch that before users see it?

That's a problem for another day, when 3.x is more widely deployed.
I'd be willing to run 2to3 on these scripts and check forward 
compatibility.
-- 
http://www.catb.org/~esr/";>Eric S. Raymond
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-24 Thread Pete Wyckoff
e...@thyrsus.com wrote on Thu, 20 Dec 2012 09:13 -0500:
> diff --git a/git-p4.py b/git-p4.py
> index 551aec9..ec060b4 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -12,6 +12,11 @@ import optparse, sys, os, marshal, subprocess, shelve
>  import tempfile, getopt, os.path, time, platform
>  import re, shutil
>  
> +if sys.hexversion < 0x0204:
> +# The limiter is the subprocess module
> +sys.stderr.write("git-p4.py: requires Python 2.4 or later.")
> +sys.exit(1)
> +
>  verbose = False

If 2.3 does not have the subprocess module, this script will fail
at the import, and not run your version test.

All the uses of sys.stderr.write() should probably include a
newline.  Presumably you used write instead of print to avoid
2to3 differences.

The name of this particular script, as users would type it, is
"git p4"; no dash and no ".py".

Many of your changes have these three problems; I just picked on
my favorite one.

> diff --git a/git-remote-testgit.py b/git-remote-testgit.py
> index 5f3ebd2..22d2eb6 100644
> --- a/git-remote-testgit.py
> +++ b/git-remote-testgit.py
> @@ -31,6 +31,11 @@ from git_remote_helpers.git.exporter import GitExporter
>  from git_remote_helpers.git.importer import GitImporter
>  from git_remote_helpers.git.non_local import NonLocalGit
>  
> +if sys.hexversion < 0x01050200:
> +# os.makedirs() is the limiter
> +sys.stderr.write("git-remote-testgit.py: requires Python 1.5.2 or 
> later.")
> +sys.exit(1)
> +

This one, though, is a bit of a lie because git_remote_helpers
needs 2.4, and you add that version enforcement in the library.

I assume what you're trying to do here is to make the
version-related failures more explicit, rather than have users
parse an ImportError traceback, e.g.  That seems somewhat useful
for people with ancient installs.

But what about the high-end of the version range?  I'm pretty
sure most of these scripts will throw syntax errors on >= 3.0,
how should we catch that before users see it?

-- Pete
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-23 Thread Eric S. Raymond
Junio C Hamano :
> Junio C Hamano  writes:
> 
> > I needed something like this on top of it to get it pass t5800.
> >
> > diff --git a/git_remote_helpers/git/__init__.py 
> > b/git_remote_helpers/git/__init__.py
> > index 776e891..5047fd4 100644
> > --- a/git_remote_helpers/git/__init__.py
> > +++ b/git_remote_helpers/git/__init__.py
> > @@ -1,3 +1,5 @@
> > +import sys
> > +
> >  if sys.hexversion < 0x0204:
> >  # The limiter is the subprocess module
> >  sys.stderr.write("git_remote_helpers: requires Python 2.4 or later.")
> 
> Ping?  Is the above the best fix for the breakage?

Sorry, I missed this the first time around.  Yes, I think it is.
 
> If it weren't __init__, I'd silently squash it in, but the filename
> feels a bit more magic than the ordinary *.py files, so I was worried
> there may be some other rules involved what can and cannot go in to
> such a file, hence I've been waiting for an ack or alternatives.

Nope, no special rules.
-- 
http://www.catb.org/~esr/";>Eric S. Raymond
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-23 Thread Junio C Hamano
Junio C Hamano  writes:

> I needed something like this on top of it to get it pass t5800.
>
> diff --git a/git_remote_helpers/git/__init__.py 
> b/git_remote_helpers/git/__init__.py
> index 776e891..5047fd4 100644
> --- a/git_remote_helpers/git/__init__.py
> +++ b/git_remote_helpers/git/__init__.py
> @@ -1,3 +1,5 @@
> +import sys
> +
>  if sys.hexversion < 0x0204:
>  # The limiter is the subprocess module
>  sys.stderr.write("git_remote_helpers: requires Python 2.4 or later.")

Ping?  Is the above the best fix for the breakage?

If it weren't __init__, I'd silently squash it in, but the filename
feels a bit more magic than the ordinary *.py files, so I was worried
there may be some other rules involved what can and cannot go in to
such a file, hence I've been waiting for an ack or alternatives.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 20/12/2012 15:13, Eric S. Raymond ha scritto:
> Signed-off-by: Eric S. Raymond 
> ---

Just my two cents.
Isn't it better to have some core Python support inside a "python/"
directory in the git source tree (e.g. e simple python/git.py), and have
*all* python code import that module?

Then you can impose a reasonable version limitation (e.g. Python >= 2.5)
inside that module (and/or inside its setup.py file).

Another advantage is that the python/git.py module can contain some very
base support for interfacing git plumbing commands, instead of having
all internal (and external) modules reinventing the wheel.

I'm writing an external command for Git, and I do plan to write such a
package, so that I don't have to reimplement all the base support in my
command source code.



Regards   Manlio
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDUhzoACgkQscQJ24LbaUQFuQCfb6QgkJHdxQSEB7nLXMN8TSmI
6/IAn3svylllaIBQfZKf0lEzNBtZJQMK
=Ar20
-END PGP SIGNATURE-
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-20 Thread Junio C Hamano
I needed something like this on top of it to get it pass t5800.

diff --git a/git_remote_helpers/git/__init__.py 
b/git_remote_helpers/git/__init__.py
index 776e891..5047fd4 100644
--- a/git_remote_helpers/git/__init__.py
+++ b/git_remote_helpers/git/__init__.py
@@ -1,3 +1,5 @@
+import sys
+
 if sys.hexversion < 0x0204:
 # The limiter is the subprocess module
 sys.stderr.write("git_remote_helpers: requires Python 2.4 or later.")
-- 
1.8.1.rc2.225.g0e05fff

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-20 Thread Junio C Hamano
"Eric S. Raymond"  writes:

>> Should the error message say ciabot.py?
>> 
>> -Peff
>
> Gack.  Yes.  Thaty's what I get for cut-and-pasting too quickly.
> The information about xnml.sex is correct, though.
>
> Want me to resubmit, or will you just patch it?

Can handle it myself; thanks for the patch.

> Note by the way that I still think the entire ciabot subtree (which is 
> my code) should just be nuked.  CIA is not coming back, wishful thinking 
> on Ilkotech's web page notwithstanding.

You are probably right, and interested people could send a patch to
resurrect it, if it turns necessary, from our last commit that has
it.  So let's apply this patch, and then remove the subtree soon
after 1.8.1 ships.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-20 Thread Eric S. Raymond
Jeff King :
> On Thu, Dec 20, 2012 at 09:13:37AM -0500, Eric S. Raymond wrote:
> 
> > diff --git a/contrib/ciabot/ciabot.py b/contrib/ciabot/ciabot.py
> > index bd24395..b55648f 100755
> > --- a/contrib/ciabot/ciabot.py
> > +++ b/contrib/ciabot/ciabot.py
> > @@ -50,6 +50,11 @@
> >  import os, sys, commands, socket, urllib
> >  from xml.sax.saxutils import escape
> >  
> > +if sys.hexversion < 0x0200:
> > +   # The limiter is the xml.sax module
> > +sys.stderr.write("import-zips.py: requires Python 2.0.0 or later.")
> > +sys.exit(1)
> 
> Should the error message say ciabot.py?
> 
> -Peff

Gack.  Yes.  Thaty's what I get for cut-and-pasting too quickly.
The information about xnml.sex is correct, though.

Want me to resubmit, or will you just patch it?

Note by the way that I still think the entire ciabot subtree (which is 
my code) should just be nuked.  CIA is not coming back, wishful thinking 
on Ilkotech's web page notwithstanding.
-- 
http://www.catb.org/~esr/";>Eric S. Raymond
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Python scripts audited for minimum compatible version and checks added.

2012-12-20 Thread Jeff King
On Thu, Dec 20, 2012 at 09:13:37AM -0500, Eric S. Raymond wrote:

> diff --git a/contrib/ciabot/ciabot.py b/contrib/ciabot/ciabot.py
> index bd24395..b55648f 100755
> --- a/contrib/ciabot/ciabot.py
> +++ b/contrib/ciabot/ciabot.py
> @@ -50,6 +50,11 @@
>  import os, sys, commands, socket, urllib
>  from xml.sax.saxutils import escape
>  
> +if sys.hexversion < 0x0200:
> + # The limiter is the xml.sax module
> +sys.stderr.write("import-zips.py: requires Python 2.0.0 or later.")
> +sys.exit(1)

Should the error message say ciabot.py?

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html