1#!/usr/bin/env python 2# -*- Mode: python -*- 3 4# Copyright (C) 2001-2012 Artifex Software, Inc. 5# All Rights Reserved. 6# 7# This software is provided AS-IS with no warranty, either express or 8# implied. 9# 10# This software is distributed under license and may not be copied, 11# modified or distributed except as expressly authorized under the terms 12# of the license contained in the file LICENSE in this distribution. 13# 14# Refer to licensing information at http://www.artifex.com or contact 15# Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, 16# CA 94903, U.S.A., +1(415)492-9861, for further information. 17# 18 19# $Id: dump_testdb,v 1.7 2004/07/14 18:21:24 ray Exp $ 20 21# 22# dump_baseline.py [<dbfile>] 23# 24# dumps (prints out) the contents of the baselinedb 25 26import string, sys, anydbm, gsconf, os 27 28def compare_field_2(s1, s2): 29 if string.split(s1,' ')[1] < string.split(s2,' ')[1]: 30 return -1 31 else: 32 return 1 33 34if len(sys.argv) == 2: 35 name=sys.argv[1] 36else: 37 name=gsconf.baselinedb 38 39if not os.path.exists(name): 40 print "cannot open",name 41 sys.exit(1) 42 43print "opening ", name 44db = anydbm.open(name) 45 46# collect the database as strings 47dump = [] 48for k in db.keys(): 49 print '-%50s- %s' % (k,db[k]) 50 51