git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] git-p4.py: support Python 2.4

From
PWPete Wyckoff <pw@padd.com>
Date
Jan 26, 2013, 12:48 UTC
Message-ID
<20130126124854.GB31052@padd.com>
In-Reply-To
<1359146641-27810-3-git-send-email-drafnel@gmail.com>
drafnel@gmail.com wrote on Fri, 25 Jan 2013 12:44 -0800:
Show 12 quoted lines
> Python 2.4 lacks the following features:
> 
>    subprocess.check_call
>    struct.pack_into
> 
> Take a cue from 460d1026 and provide an implementation of the
> CalledProcessError exception.  Then replace the calls to
> subproccess.check_call with calls to subprocess.call that check the return
> status and raise a CalledProcessError exception if necessary.
> 
> The struct.pack_into in t/9802 can be converted into a single struct.pack
> call which is available in Python 2.4.
Excellent.  Should have used struct.pack() from the get-go.
Acked-by: Pete Wyckoff <pw@padd.com>
Show 21 quoted lines
> diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
> index 21924df..be299dc 100755
> --- a/t/t9802-git-p4-filetype.sh
> +++ b/t/t9802-git-p4-filetype.sh
> @@ -105,12 +105,13 @@ build_gendouble() {
>  	cat >gendouble.py <<-\EOF
>  	import sys
>  	import struct
> -	import array
>  
> -	s = array.array("c", '\0' * 26)
> -	struct.pack_into(">L", s,  0, 0x00051607)  # AppleDouble
> -	struct.pack_into(">L", s,  4, 0x00020000)  # version 2
> -	s.tofile(sys.stdout)
> +	s = struct.pack(">LL18s",
> +			0x00051607,  # AppleDouble
> +			0x00020000,  # version 2
> +			""           # pad to 26 bytes
> +	)
> +	sys.stdout.write(s);
>  	EOF
One stray semicolon.

In terms of maintenance, I'll not run tests with 2.4 or 2.5 myself, but maybe you would be willing to check an RC candidate each release?

		-- Pete
Previous: Brandon CaseyNext: Brandon Casey
Message 6 of 8 in “git-p4 support for older python”
  1. 0/2 git-p4 support for older pythonBrandon Casey, Jan 25, 2013
  2. 1/2 git-p4.py: support Python 2.5Brandon Casey, Jan 25, 2013
  3. Pete WyckoffJan 26, 2013
  4. Brandon CaseyJan 26, 2013
  5. 2/2 git-p4.py: support Python 2.4Brandon Casey, Jan 25, 2013
  6. Pete WyckoffJan 26, 2013
  7. Brandon CaseyJan 26, 2013
  8. Junio C HamanoJan 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.