7ec@sBdZddlZyddlZWnek r;dZnXyddlZWnek redZnXyddlZWnek rdZnXyddlZWnek rdZnXddlZyddl Z Wnek rddl Z nXej dZ dZ dZedkr>ejeej dndS(s5 Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ] Convert the database file given on the command line to a pickle representation. The optional flags indicate the type of the database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for write access (deleting any existing data). If no pickle file is named, the pickle output is written to standard output. iNicCstjjttdS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytusage/sc Csy1tj|dddddddg\}}Wntjk rOtdSXt|d kstt|d krtdSt|dkr|d }tj}nN|d }yt|dd }Wn*tk rtjj d |ddSXd}x|D]\}}|d"krOy t j }Wqt k rKtjj ddSXq|d#kry t j}Wqt k rtjj ddSXq|d$kry t j}Wqt k rtjj ddSXq|d%kry tj}Wqt k rtjj ddSXq|d&krSy tj}Wqt k rOtjj ddSXq|d'kry tj}Wqt k rtjj ddSXqqW|dkrt dkrtjj dtjj ddSt j }ny||d}Wn9t jk r.tjj d |tjj d!dSXx7|jD])}tj|||f|ddkq<W|j|jd S((NthbrdagthashtbtreetrecnotdbmtgdbmtanydbmiiitwbsUnable to open %s s-hs--hashsbsddb module unavailable. s-bs--btrees-rs--recnos-as--anydbmsanydbm module unavailable. s-gs--gdbmsgdbm module unavailable. s-ds--dbmsdbm module unavailable. sbsddb module unavailable - smust specify dbtype. trsUnable to open %s. s&Check for format or version mismatch. (s-hs--hash(s-bs--btree(s-rs--recno(s-as--anydbm(s-gs--gdbm(s-ds--dbm(tgetoptterrorRtlenRtstdouttopentIOErrorRRtNonetbsddbthashopentAttributeErrortbtopentrnopenR R R tkeystpickletdumptclose( targstoptstdbfiletpfiletdbopentopttargtdbtk((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytmain2s  $                          '  t__main__i(RRRt ImportErrorRR R R RtcPickleRtargvtprogRR(t__name__texit(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pyts6              T