git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Makefile: Remove usage of deprecated Python "has_key" method
@ 2010-03-28  0:45 David Aguilar
  2010-03-28 16:38 ` Junio C Hamano
  2010-03-29  2:16 ` Johan Herland
  0 siblings, 2 replies; 6+ messages in thread
From: David Aguilar @ 2010-03-28  0:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sverre Rabbelier, Johan Herland, git

"has_key" is a deprecated dictionary method in Python 2.6+.
Simplify the sys.path manipulation for installed scripts by
passing a default value to os.getenv().

SCRIPT_PYTHON is currently empty but this future-proofs us.
It also fixes things for users who maintain local git forks
with their own SCRIPT_PYTHON additions.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 Makefile |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 3a6c6ea..806ccdf 100644
--- a/Makefile
+++ b/Makefile
@@ -1609,9 +1609,8 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
 	    -e '}' \
 	    -e 's|^import sys.*|&; \\\
 	           import os; \\\
-	           sys.path[0] = os.environ.has_key("GITPYTHONLIB") and \\\
-	                         os.environ["GITPYTHONLIB"] or \\\
-	                         "@@INSTLIBDIR@@"|' \
+	           sys.path.insert(0, os.getenv("GITPYTHONLIB",\
+	                                        "@@INSTLIBDIR@@"));|' \
 	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    $@.py >$@+ && \
 	chmod +x $@+ && \
-- 
1.7.0.3.291.g5e4f6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-29  4:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-28  0:45 [PATCH] Makefile: Remove usage of deprecated Python "has_key" method David Aguilar
2010-03-28 16:38 ` Junio C Hamano
2010-03-28 21:54   ` David Aguilar
2010-03-29  0:23     ` Tay Ray Chuan
2010-03-29  4:08     ` Junio C Hamano
2010-03-29  2:16 ` Johan Herland

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).