Description: Set default MIP_TABLE_PATH on debian.
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2011-11-23
Forwarded: no

Index: drslib-0.3.1.p3/drslib/config.py
===================================================================
--- drslib-0.3.1.p3.orig/drslib/config.py
+++ drslib-0.3.1.p3/drslib/config.py
@@ -37,10 +37,17 @@ else:
     try:
         table_path = config.get('tables', 'path')
     except:
-        raise Exception("Please configure your MIP table path using MIP_TABLE_PATH or a config file")
+        # On Debian, the user may have cmip5-cmor-tables installed. Fall back to these.
+        if os.path.exists('/usr/share/cmor'):
+           table_path ='/usr/share/cmor'
+        else:
+            raise Exception("Please configure your MIP table path using MIP_TABLE_PATH or a config file")
 
 try:
-    table_path_csv = config.get('tables', 'path_csv')
+    if os.path.exists('/usr/share/cmor'):
+        table_path_csv = '/usr/share/cmor'
+    else:
+        table_path_csv = config.get('tables', 'path_csv')
 except:
     table_path_csv = '%s_csv' % os.path.normpath(table_path)
 
