From: Jerry McBride <mcbrides9@comcast.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Documentation Index
Date: Sun, 31 Dec 2006 12:38:06 -0500 [thread overview]
Message-ID: <200612311238.06348.mcbrides9@comcast.net> (raw)
In-Reply-To: <9acccfe50612302100h2cae0dc8t301b3ea522808df5@mail.gmail.com>
On Sunday 31 December 2006 00:00, Kevin O'Gorman wrote:
> Hey, Jerry, wanna make a project team? I woulda done Python if I had
> thought it was gonna get big. It now seems like that would be a good idea.
> Care to:
> 1) share your code?
> 2) start a sourceforge project?
> 3) just tantalize us with your results?
>
It's far, far from being finished or polished... here it is:
#!/usr/bin/python
#
try:
import psyco
psyco.full()
except ImportError:
print "Non-Fatal error importing PSYCO"
pass
#
try:
import readline
except ImportError:
print "Fatal Error importing readline"
sys.exit(1)
#
try:
import struct
except ImportError:
print "Fatal Error importing struct"
sys.exit(1)
#
try:
import string
except ImportError:
print "Fatal Error importing string"
sys.exit(1)
#
try:
import sys
except ImportError:
print "Fatal Error imporing sys"
sys.exit(1)
#
try:
import os
except ImportError:
print "Fatal Error imporing os"
sys.exit(1)
al="array.list"
il="index.list"
ni="/var/www/localhost/htdocs/index2.html"
z=0
rightNow="today!"
version="1.0"
print "Every Damn Index - version ",version
print ""
print 'Scanning hard drive and creating list of all discovered files.'
print ""
os.system('tree -fixn --noreport -o '+il+' /')
print 'Construction of index list completed!'
print ""
print"Reading text from: ", il
print ""
#
# read index.list and create new array list
#
input=open(il,'r')
output=open(al,'w')
for line in input.readlines():
# strip off leading and trailing spaces
line = string.strip(line, " ")
# stip off CR's
line = string.rstrip(line,chr(10))
words=string.split(line,"/")
steps=len(words)
if words[steps-1]=="index.html":
output.writelines(line+chr(10))
words=string.split(line,".")
steps=len(words)
if words[steps-1]=="pdf":
output.writelines(line+chr(10))
words=string.split(line,".")
steps=len(words)
if words[steps-1]=="chm":
output.writelines(line+chr(10))
z=z+1
if z > 2000:
print ".",
z=0
print""
print "Successfully processed ",il
print""
input.close()
output.close()
print"Reading text from: "+al+" and building new "+ni
print""
input=open(al,'r')
output=open(ni,'w')
output.writelines('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'+chr(10))
output.writelines("<html>"+chr(10))
output.writelines("<head>"+chr(10))
output.writelines("<title>Evey Damn Index "+version+"- copyright Jerome D.
McBride - 2006</title>"+chr(10))
output.writelines('<meta name="GENERATOR" content="NONE">'+chr(10))
output.writelines('<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">'+chr(10))
#output.writelines('<img id= "logo"
src="http://www.expertsrt.com/images/xrt.png" alt="ERT Logo"
style="vertical-align:top"/>'+chr(10))
output.writelines("</head>"+chr(10))
output.writelines("<body>"+chr(10))
output.writelines("<hr>"+chr(10))
output.writelines("<strong> Every Damn Index - Version "+version+"
</strong>"+chr(10))
output.writelines("<hr>"+chr(10))
output.writelines("This page conatins a list of all available html
indexes, .pdf and .chm files"+chr(10))
output.writelines("created "+rightNow+chr(10))
output.writelines("<hr>"+chr(10))
output.writelines("<br>"+chr(10))
z=0
for line in input.readlines():
# strip off leading and trailing spaces
line = string.strip(line, " ")
# strip off leading and trailing slashes
line = string.strip(line, "/")
# stip off CR's
line = string.rstrip(line,chr(10))
print 'Looking for package info for:', line
#clean up previous info.dat file
os.system("rm info.dat 2>/dev/null 1>/dev/null")
os.system('/usr/bin/equery belongs '+line+' >info.dat')
inputData=open('info.dat','r')
infoText=inputData.read()
inputData.close()
if len(infoText)==0:
infoText="PNA/PNA"
words=string.split(infoText,"/")
steps=len(words)
groupName=words[0]
packageName=words[1]
output.writelines('<br>--'+packageName+'-- <a
href="'+line+'">documentation</a> found at '+line+'</br>'+chr(10))
output.writelines("<hr>"+chr(10))
output.writelines("The end..."+chr(10))
output.writelines("<br>"+chr(10))
output.writelines("</body>"+chr(10))
output.writelines("</html>"+chr(10))
print "New index2.html written to ",ni,"."
print ""
print "Program successfully shutdown."
print ""
input.close()
output.close()
os.system("rm "+al+" 2>/dev/null 1>/dev/null")
os.system("rm "+il+" 2>/dev/null 1>/dev/null")
os.system("rm info.dat 2>/dev/null 1>/dev/null")
sys.exit(0)
As for manning a project... time hasn't allowed me the pleasure of a decent
day off from work. I would, however, contribute as I can.
Cheers all and enjoy
--
Jerry McBride
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2006-12-31 17:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-31 0:03 [gentoo-user] Documentation Index Kevin O'Gorman
2006-12-31 0:19 ` Graham Murray
2006-12-31 3:20 ` Jerry McBride
2006-12-31 4:04 ` David Relson
2006-12-31 5:00 ` Kevin O'Gorman
2006-12-31 17:38 ` Jerry McBride [this message]
2007-01-01 1:28 ` Kevin O'Gorman
2007-01-01 11:43 ` Neil Bothwick
2007-01-01 18:18 ` Jerry McBride
2006-12-31 10:50 ` Mick
2006-12-31 10:57 ` iddqd
2006-12-31 12:39 ` Kent Fredric
2006-12-31 12:46 ` Mick
2007-01-04 15:13 ` Etaoin Shrdlu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200612311238.06348.mcbrides9@comcast.net \
--to=mcbrides9@comcast.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox