From 16b2a87b24429ce72c2140ab94c3897a92159a75 Mon Sep 17 00:00:00 2001 From: Yusuke Shinyama Date: Mon, 3 Jan 2011 18:11:16 +0900 Subject: [PATCH] CMAP_PATH environment variable support --- pdfminer/cmapdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pdfminer/cmapdb.py b/pdfminer/cmapdb.py index 1ba3233..ffccff5 100644 --- a/pdfminer/cmapdb.py +++ b/pdfminer/cmapdb.py @@ -240,7 +240,8 @@ class CMapDB(object): filename = '%s.pickle.gz' % name if klass.debug: print >>sys.stderr, 'loading:', name - for directory in os.path.dirname(cmap.__file__), '/usr/share/pdfminer/': + default_path = os.environ.get('CMAP_PATH', '/usr/share/pdfminer/') + for directory in (os.path.dirname(cmap.__file__), default_path): path = os.path.join(directory, filename) if os.path.exists(path): gzfile = gzip.open(path)