;ò = ÄDc@sìdkZdkZdkZdkZdkZdkZdkZdkZdki Z dk i Z dk i Z dkTdkiZdkiZdkiZdklZlZlZdefd„ƒYZdeiefd„ƒYZeZdS(N(s*(sallsimapsifiltersPeriodicFileDownloadercBs/tZdZeZd„Zd„Zd„ZRS(sA class to periodically download a file/files. A class-level dictionary 'periodicFiles' maps names of files to three-tuples of (url, seconds between downloads, function to run with downloaded file). 'url' should be in some form that urllib2.urlopen can handle (do note that urllib2.urlopen handles file:// links perfectly well.) 'seconds between downloads' is the number of seconds between downloads, obviously. An important point to remember, however, is that it is only engaged when a command is run. I.e., if you say you want the file downloaded every day, but no commands that use it are run in a week, the next time such a command is run, it'll be using a week-old file. If you don't want such behavior, you'll have to give an error mess age to the user and tell him to call you back in the morning. 'function to run with downloaded file' is a function that will be passed a string *filename* of the downloaded file. This will be some random filename probably generated via some mktemp-type-thing. You can do what you want with this; you may want to build a database, take some stats, or simply rename the file. You can pass None as your function and the file with automatically be renamed to match the filename you have it listed under. It'll be in conf.supybot.directories.data, of course. Aside from that dictionary, simply use self.getFile(filename) in any method that makes use of a periodically downloaded file, and you'll be set. cOs |itjo td‚nh|_h|_x¾|iD]³}|i|dtjobtii t i i i ƒ|ƒ}tii|ƒoti|ƒi|i|ftp://ftp.us.debian.org/debian/dists/unstable/Contents-i386.gzi€: cs|idƒ| o| o ti‚n|o|o|iddtƒnxK|D]C\}}|djo|i dƒ} qV|djo |} qVqVW|o5t i|i dƒƒ} | idƒ} d| } nyti| tiƒ‰Wn4tij o%}|itd |ƒdtƒnX|id ƒoCti|iƒ} td „td „t‡d †| ƒƒƒ}n\y2tid d| |igƒ\}}|i!ƒWn&t"j o|iddtƒnXt#ƒ}z»x´|D]¬} t&|ƒdjo|iddtƒnyMt'| dƒo| i(dƒ} n| i)ƒ\}} |djowênWnt,j o qênX|i-| i)dƒƒqêWWdt'|dƒo|i!ƒnXt&|ƒdjo|i.dƒn|i.tdt/|ƒƒƒdS(s?[--{regexp,exact} ] [] Returns packages in Debian that includes files matching . If --regexp is given, returns packages that include files matching the given regexp. If --exact is given, returns packages that include files matching exactly the string given. sContents-i386.gzsFYou must specify either a glob or a regexp/exact search, but not both.sRaisesexacts/sregexps$s.*%s.* sError in regexp: %ss pythonZgrepcCs|dS(Ni(stup(stup((s./Debian/plugin.pysÆscsˆi|ƒ|fS(N(sre_objssearchsline(sline(sre_obj(s./Debian/plugin.pysÈsszgreps-ies®This command won't work on this platform. If you think it should (i.e., you know that you have a zgrep binary somewhere) then file a bug about it at http://supybot.sf.net/ .ids:More than 100 packages matched, please narrow your search.sgroupisFILEs,Nscloses#I found no packages with that file.s%L(0sselfsgetFilesoptlistsglobs callbackss ArgumentErrorsircserrorsTruesoptionsargslstripsregexpsfnmatchs translatesrstripsrescompilesIsre_objsesformats registryValuesgzipsopenscontentssfdsimapsifiltersrspopen2spopen4swscloses TypeErrorssetspackagesslineslenshasattrsgroupssplitsfilenamespkg_lists ValueErrorsupdatesreplyssorted(sselfsircsmsgsargssoptlistsglobsargsfilenamesoptionspkg_listsre_objsfdsregexpslinespackagessesrsw((sre_objs./Debian/plugin.pysfile¦sl      !  $     sregexps regexpMatchersexacts somethingsglobs"

Package ([^<]+)

(.*?)cCsˆd}x7|D]/\}}|djo|iddƒ}q q Wg} d|jo|iddt ƒnt i i |ƒ}|||f;}yt i i|ƒ} Wn7t i ij o%}|itd|ƒdt ƒnXd | jo|id dt ƒn|ii| ƒ}| o)|itd t i i|ƒ|ƒƒnBx|D]}|d }tiƒ}|i|d ƒ|idƒ} g}g}d„}x=| D]5} |i$| i%i&ƒ|i$|| idƒƒƒq¢W|o|oixft'||ƒD]Q}|d }di)|d ƒ} td|di)|| gƒƒ}| i$|ƒqùWqJqJWtdt,| ƒdi)| ƒƒ}|i|ƒdS(sL[--exact] [{stable,testing,unstable,experimental}] Returns the current version(s) of a Debian package in the given branch (if any, otherwise all available ones are displayed). If --exact is specified, only packages whose name exactly matches will be reported. sqhttp://packages.debian.org/cgi-bin/search_packages.pl?keywords=%s&searchon=names&version=%s&release=all&subword=1sexacts &subword=1ss*s)Wildcard characters can not be specified.sRaises&I couldn't reach the search page (%s).sis down at the momentsCPackages.debian.org is down at the moment. Please try again later.sNo package found for %s (%s)iislicCsrgi}|D]}||iiiƒƒq~}gi}|D]&}|t i i |ddƒdƒqA~SdS(Ns:ii( sappends_[1]sbrsbsnextsstringsstripsverssvsutilssstrsrsplit(sbrsverssbs_[1]sv((s./Debian/plugin.pys branchVerss3sbrs, s%s (%s)s: s%i matches found: %ss; N(.surlsoptlistsoptions_sreplaces responsesspackagesircserrorsTruesutilsswebsurlquotesbranchsgetUrlshtmlsErrorsesformatsselfs _deblistresfindallspkgssreplys urlunquotespkgspkgMatchs BeautifulSoupssoupsfeedsfetchs liBranchessbranchessversionss branchVersslisappendsasstringszipspairssjoinsverssslensresp(sselfsircsmsgsargssoptlistsbranchspackagespkgspkgMatchslis responsessvers liBranchesshtmlspkgssrespsoptionsbranchess_spairssesurlsversionsssoupsss branchVers((s./Debian/plugin.pysversionïs^            ssliteralsstablestestingsunstables experimentalsallstextscsÎg} d„}x\|D]T\} }| djo| itiƒq| djod|}|d„}qqW| i|ƒx6|D].} t i | ƒ} | it i | ƒiƒq‚Wg}ytiidƒ} Wn4tiij o"}|it|ƒdtƒnXx†| D]~} |ii| ƒ}|o_|idƒ‰tt t!‡d †| ƒƒo-tii"ˆd dƒd }|i|ƒqŒqqWt$|ƒd jo|id ƒn|i%t&d |ƒƒdS(s[--{regexp,arch} ] [ ...] Checks debian incoming for a matching package name. The arch parameter defaults to i386; --regexp returns only those package names that match a given regexp, and normal matches use standard *nix globbing. cCs d|jS(Ns_i386.(ss(ss((s./Debian/plugin.pys4ssregexpsarchs_%s.cCs ||jS(N(sargss(sssarg((s./Debian/plugin.pys:sshttp://incoming.debian.org/sRaiseics |ˆƒS(N(spsname(sp(sname(s./Debian/plugin.pysHss_is No packages matched that search.s%LN('s predicatess archPredicatesoptlistsoptionsargsappendsrssearchsglobssglobsfnmatchs translatesrescompilespackagessutilsswebsgetUrlFdsfdsErrorsesircserrorsstrsTrueslinesselfs _incomingResmsgroupsnamesallsNonesimapsrsplitsrealnameslensreplysformat(sselfsircsmsgsargssoptlistsglobssargsrealnames archPredicatesoptionsglobsfds predicatesslinespackagessesnamesm((snames./Debian/plugin.pysincoming+s>      sarchcCs/|idtiƒoti|ƒSn|SdS(Nsbold(sselfs registryValuesdynamicschannelsircutilssboldss(sselfss((s./Debian/plugin.pysboldTss : ([^<]+) Reports various statistics (from http://packages.qa.debian.org/) about . s(http://packages.qa.debian.org/%s/%s.htmlis Error 404ssource package nameistdsclasss labelcells contentcells Last versions%s: %ss Maintainersashrefis %s: %s %usAll bugss%i TotalsRelease Criticals%i RCsImportant and Normals%i Important/NormalsMinor and Wishlists%i Minor/WishlistsFixed and Pendings%i Fixed/PendingsSubscribers counts%s: %is Subscriberss. sBugss; s As of %s, %sN(+spkgslowersutilsswebsgetUrlstextsircs errorInvalidsNonesupdatedsselfs_updatessearchsmsgroups BeautifulSoupssoupsfeedszipsfetchspairsslabelscontentsstringsboldsversionsasnamesemailsformats mungeEmails maintainersfirstsbugsAllsbugsRCsbugss bugsMinors bugsFixeds subscriberssbugLsjoinsssreply(sselfsircsmsgsargsspkgs maintainerstexts bugsFixedsbugsAllslabelscontentsversionsemailsupdatedsbugLs subscribersspairssnamesmsbugss bugsMinorssoupsssbugsRC((s./Debian/plugin.pysstatsZsV      #  7ssomethingWithoutSpacess
  • ]+>([^<]+)c Csôytiid|ƒ} Wn4tiij o"}|it |ƒdt ƒnXg}x^| D]V} |ii| ƒ}|o7|idƒ}ti||ƒo|i|ƒq´q^q^W| iƒ|o|itd|ƒƒn|idƒdS(s[{main,contrib,non-free}] [] Checks for packages that have been added to Debian's unstable branch in the past week. If no glob is specified, returns a list of all packages. If no section is specified, defaults to main. s-http://packages.debian.org/unstable/newpkg_%ssRaiseis%Ls No packages matched that search.N(sutilsswebsgetUrlFdssectionsfdsErrorsesircserrorsstrsTruespackagesslinesselfs _newpkgressearchsmsgroupsfnmatchsglobsappendsclosesreplysformat( sselfsircsmsgsargsssectionsglobspackagessesmsfdsline((s./Debian/plugin.pysnewŽs" smainscontribsnon-frees*s>.*(?:severity set to `([^\']+)\'|severity:\s+([^<]+))sPackage: <[^>]+>([^<]+)]+>([^<]+)([^<]+)sDate: ([^;]+);sTags: ([^<]+)c séd|}ytii|ƒ‰Wn4tiij o"}|i t |ƒdt ƒnXdˆjo|i ddt ƒnt ‡d†|iƒ}|iiˆƒ}|iiˆƒ} tt|ƒot |idddfƒ} td | Œ} t tiit d „|ƒƒ} t| | Œ} |oYtt|iƒƒ}|o9tii|d ƒ}| td |id ƒ|ƒ7} qn| o,| td |idƒ| idƒƒ7} n| td|ƒ7} |i| ƒn|idƒdS(sK Returns a description of the bug with bug id . shttp://bugs.debian.org/%ssRaisesThere is no record of Bugs3I could not find a bug report matching that number.cs |iˆƒS(N(spssearchstext(sp(stext(s./Debian/plugin.pys¿ssPackagesSubjectsReporteds#%s: %%s; %s: %%s; %s: by %%s on %%scCs |idƒS(Ni(spsgroup(sp((s./Debian/plugin.pysÆsis; %s: %ssSeveritysTagsis; %us,I was unable to properly parse the BTS page.N( sbugsurlsutilsswebsgetUrlstextsErrorsesircserrorsstrsTruesmapsselfs _searchesssearchess _severityssearchssevs_tagsstagssallsNonesboldsLsformatsresps htmlToTextsfiltersgroupssgroupsreply( sselfsircsmsgsargssbugssearchessessevsurlstextsrespsLstags((stexts./Debian/plugin.pysbug²s6   !',sidsbugs"\+2">([^<]+) Turns into a 'debian package name' using http://www.pigdog.com/features/dpn.html. s/http://www.pigdog.org/cgi_bin/dpn.phtml?name=%ss+sRaiseisUnable to parse webpage.N(surlsutilsswebsgetUrlsjoinswordsstextsErrorsesircserrorsstrsTruesselfs_dpnRessearchsmsNonesreplysgroupserrorPossibleBug( sselfsircsmsgsargsswordssesurlstextsm((s./Debian/plugin.pys debianizeÖs# (.s__name__s __module__sTruesthreadedsNones periodicFilessconfssupybots directoriessdatasdirizescontentssfileswrapsgetoptss additionalsresDOTALLs IGNORECASEs _debreflagsscompiles _deblistresversionsoptionalsIs _incomingResincomingsthreadsanysbolds_updatesstatss _newpkgresnews _severitysSs_packages _reporters_subjects_dates_tagss _searchessbugs_dpnRes debianizesmany(((s./Debian/plugin.pysDebianœsF D3 60 $ 0  1    ! (sossresgzipstimespopen2sfnmatchs threadings BeautifulSoups supybot.confsconfs supybot.utilssutilss supybot.worldsworldssupybot.commandsssupybot.pluginsspluginsssupybot.ircutilssircutilsssupybot.callbackss callbacksssupybot.utils.itersallsimapsifiltersobjectsPeriodicFileDownloadersPluginsDebiansClass(sifiltersfnmatchsallsPeriodicFileDownloaders threadingsutilsspluginsspopen2s BeautifulSoupsDebians callbackssresClasssconfstimesgzipsworldsossimapsircutils((s./Debian/plugin.pys?s&              kÿN