Revision: 4094
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4094&view=rev
Author:   dsdale
Date:     2007-11-02 05:55:51 -0700 (Fri, 02 Nov 2007)

Log Message:
-----------
improved ghostscript version checking

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/__init__.py
    trunk/matplotlib/lib/matplotlib/config/checkdep.py
    trunk/matplotlib/lib/matplotlib/config/cutils.py
    trunk/matplotlib/lib/matplotlib/text.py

Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-01 16:57:26 UTC (rev 
4093)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-02 12:55:51 UTC (rev 
4094)
@@ -234,12 +234,11 @@
 def checkdep_ghostscript():
     try:
         if sys.platform == 'win32':
-            command = 'gswin32c -v'
+            command = 'gswin32c --version'
         else:
-            command = 'gs -v'
+            command = 'gs --version'
         stdin, stdout = os.popen4(command)
-        line = stdout.readlines()[0]
-        v = line.split()[-2]
+        v = stdout.read()[:-1]
         vtest = '.'.join(v.split('.')[:2]) # deal with version numbers like 
'7.07.1'
         float(vtest)
         return vtest

Modified: trunk/matplotlib/lib/matplotlib/config/checkdep.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/checkdep.py  2007-11-01 16:57:26 UTC 
(rev 4093)
+++ trunk/matplotlib/lib/matplotlib/config/checkdep.py  2007-11-02 12:55:51 UTC 
(rev 4094)
@@ -4,28 +4,27 @@
 import warnings
 import distutils.version as version
 
+tex_req = '3.1415'
+gs_req = '7.07'
+gs_sugg = '8.60'
+dvipng_req = '1.5'
+pdftops_req = '3.0'
+
 def dvipng():
     try:
         stdin, stdout = os.popen4('dvipng -version')
-        line = stdout.readlines()[1]
-        v = line.split()[-1]
-        float(v)
-        return v
+        return stdout.readlines()[1].split()[-1]
     except (IndexError, ValueError):
         return None
 
 def ghostscript():
     try:
         if sys.platform == 'win32':
-            command = 'gswin32c -v'
+            command = 'gswin32c --version'
         else:
-            command = 'gs -v'
+            command = 'gs --version'
         stdin, stdout = os.popen4(command)
-        line = stdout.readlines()[0]
-        v = line.split()[-2]
-        vtest = '.'.join(v.split('.')[:2]) # deal with version numbers like 
'7.07.1'
-        float(vtest)
-        return vtest
+        return stdout.read()[:-1]
     except (IndexError, ValueError):
         return None
 
@@ -35,9 +34,7 @@
         line = stdout.readlines()[0]
         pattern = '3\.1\d+'
         match = re.search(pattern, line)
-        v = match.group(0)
-        float(v)
-        return v
+        return match.group(0)
     except (IndexError, ValueError):
         return None
 
@@ -46,9 +43,7 @@
         stdin, stdout = os.popen4('pdftops -v')
         for line in stdout.readlines():
             if 'version' in line:
-                v = line.split()[-1]
-        float(v)
-        return v
+                return line.split()[-1]
     except (IndexError, ValueError):
         return None
 
@@ -66,8 +61,6 @@
         return False
 
     flag = True
-    gs_req = '7.07'
-    gs_sugg = '7.07'
     gs_v = ghostscript()
     if compare_versions(gs_v, gs_sugg): pass
     elif compare_versions(gs_v, gs_req):
@@ -81,14 +74,13 @@
                        'system.') % gs_req)
 
     if s == 'xpdf':
-        pdftops_req = '3.0'
         pdftops_v = pdftops()
         if compare_versions(pdftops_v, pdftops_req): pass
         else:
             flag = False
             warnings.warn(('matplotlibrc ps.usedistiller can not be set to '
-                           'xpdf unless xpdf-%s or later is installed on your '
-                           'system.') % pdftops_req)
+                           'xpdf unless pdftops-%s or later is installed on '
+                           'your system.') % pdftops_req)
 
     if flag:
         return s
@@ -99,10 +91,6 @@
     if not s:
         return False
 
-    tex_req = '3.1415'
-    gs_req = '7.07'
-    gs_sugg = '7.07'
-    dvipng_req = '1.5'
     flag = True
 
     tex_v = tex()

Modified: trunk/matplotlib/lib/matplotlib/config/cutils.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/cutils.py    2007-11-01 16:57:26 UTC 
(rev 4093)
+++ trunk/matplotlib/lib/matplotlib/config/cutils.py    2007-11-02 12:55:51 UTC 
(rev 4094)
@@ -55,8 +55,6 @@
     else:
         raise RuntimeError('please define environment variable $HOME')
 
-
-
 get_home = verbose.wrap('$HOME=%s', _get_home, always=False)
 
 def _get_configdir():
@@ -89,9 +87,9 @@
         os.mkdir(p)
 
     return p
+
 get_configdir = verbose.wrap('CONFIGDIR=%s', _get_configdir, always=False)
 
-
 def _get_data_path():
     'get the path to matplotlib data'
 

Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py     2007-11-01 16:57:26 UTC (rev 
4093)
+++ trunk/matplotlib/lib/matplotlib/text.py     2007-11-02 12:55:51 UTC (rev 
4094)
@@ -654,7 +654,7 @@
         self._text = '%s' % (s,)
 
     def is_math_text(self, s):
-        if rcParams['text.usetex']: return 'TeX'        
+        if rcParams['text.usetex']: return 'TeX'
 
         # Did we find an even number of non-escaped dollar signs?
         # If so, treat is as math text.


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to