git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brandon Casey <drafnel@gmail.com>
To: <git@vger.kernel.org>
Cc: <pw@padd.com>, <esr@thyrsus.com>, <john@keeping.me.uk>,
	Brandon Casey <drafnel@gmail.com>,
	Brandon Casey <bcasey@nvidia.com>
Subject: [PATCH 1/2] git-p4.py: support Python 2.5
Date: Fri, 25 Jan 2013 12:44:00 -0800	[thread overview]
Message-ID: <1359146641-27810-2-git-send-email-drafnel@gmail.com> (raw)
In-Reply-To: <1359146641-27810-1-git-send-email-drafnel@gmail.com>

Python 2.5 and older do not accept None as the first argument to
translate() and complain with:

   TypeError: expected a character buffer object

Satisfy this older python by calling maketrans() to generate an empty
translation table and supplying that to translate().

This allows git-p4 to be used with Python 2.5.

Signed-off-by: Brandon Casey <bcasey@nvidia.com>
---
 INSTALL   | 2 +-
 git-p4.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/INSTALL b/INSTALL
index 28f34bd..fc723b3 100644
--- a/INSTALL
+++ b/INSTALL
@@ -131,7 +131,7 @@ Issues of note:
 	  use English. Under autoconf the configure script will do this
 	  automatically if it can't find libintl on the system.
 
-	- Python version 2.6 or later is needed to use the git-p4
+	- Python version 2.5 or later is needed to use the git-p4
 	  interface to Perforce.
 
  - Some platform specific issues are dealt with Makefile rules,
diff --git a/git-p4.py b/git-p4.py
index 2da5649..4f95d7a 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -768,7 +768,8 @@ def wildcard_encode(path):
     return path
 
 def wildcard_present(path):
-    return path.translate(None, "*#@%") != path
+    from string import maketrans
+    return path.translate(maketrans("",""), "*#@%") != path
 
 class Command:
     def __init__(self):
-- 
1.8.1.1.297.gad3d74e


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

  reply	other threads:[~2013-01-25 20:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25 20:43 [PATCH 0/2] git-p4 support for older python Brandon Casey
2013-01-25 20:44 ` Brandon Casey [this message]
2013-01-26 12:45   ` [PATCH 1/2] git-p4.py: support Python 2.5 Pete Wyckoff
2013-01-26 18:19     ` Brandon Casey
2013-01-25 20:44 ` [PATCH 2/2] git-p4.py: support Python 2.4 Brandon Casey
2013-01-26 12:48   ` Pete Wyckoff
2013-01-26 19:02     ` Brandon Casey
2013-01-25 21:10 ` [PATCH 0/2] git-p4 support for older python Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359146641-27810-2-git-send-email-drafnel@gmail.com \
    --to=drafnel@gmail.com \
    --cc=bcasey@nvidia.com \
    --cc=esr@thyrsus.com \
    --cc=git@vger.kernel.org \
    --cc=john@keeping.me.uk \
    --cc=pw@padd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).