소스 검색

Env var GNUPLOT overrides gnuplot path.

By default 'gnuplot' will be searched from the system path.
Heikki Hokkanen 17 년 전
부모
커밋
80ca8cb2ef
1개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  1. 8
    3
      gitstats

+ 8
- 3
gitstats 파일 보기

@@ -1,5 +1,5 @@
1 1
 #!/usr/bin/env python
2
-# Copyright (c) 2007 Heikki Hokkanen <hoxu@users.sf.net>
2
+# Copyright (c) 2007-2008 Heikki Hokkanen <hoxu@users.sf.net>
3 3
 # GPLv2
4 4
 import subprocess
5 5
 import datetime
@@ -10,13 +10,18 @@ import shutil
10 10
 import sys
11 11
 import time
12 12
 
13
-GNUPLOT = 'c:/tools/gnuplot/bin/wgnuplot_pipes.exe'
14 13
 GNUPLOT_COMMON = 'set terminal png transparent\nset size 0.5,0.5\n'
15 14
 
16 15
 exectime_internal = 0.0
17 16
 exectime_external = 0.0
18 17
 time_start = time.time()
19 18
 
19
+# By default, gnuplot is searched from path, but can be overridden with the
20
+# environment variable "GNUPLOT"
21
+gnuplot_cmd = 'gnuplot'
22
+if 'GNUPLOT' in os.environ:
23
+	gnuplot_cmd = os.environ['GNUPLOT']
24
+
20 25
 def getpipeoutput(cmds, quiet = False):
21 26
 	def beautify_name(cmds):
22 27
 		ret = cmds[0]
@@ -807,7 +812,7 @@ plot 'lines_of_code.dat' using 1:2 w lines
807 812
 		os.chdir(path)
808 813
 		files = glob.glob(path + '/*.plot')
809 814
 		for f in files:
810
-			out = getpipeoutput((GNUPLOT + ' "%s"' % f,))
815
+			out = getpipeoutput((gnuplot_cmd + ' "%s"' % f,))
811 816
 			if len(out) > 0:
812 817
 				print out
813 818