[Python-checkins] CVS: python/nondist/peps pep2html.py,1.12,1.13
Jeremy Hylton
python-dev@python.org
Mon, 28 Aug 2000 09:00:51 -0700
Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv13884
Modified Files:
pep2html.py
Log Message:
new usage to support conversion of only specified PEPs
Usage: %(PROGRAM)s [options] [peps]
Notes:
The optional argument peps can be either pep numbers or .txt files.
Options:
-u/--user
SF username
[rest is the same]
Index: pep2html.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** pep2html.py 2000/08/17 04:27:04 1.12
--- pep2html.py 2000/08/28 16:00:49 1.13
***************
*** 3,10 ****
convert PEP's to (X)HTML - courtesy of /F
! Usage: %(PROGRAM)s [options] [sf_username]
Options:
-i/--install
After generating the HTML, install it SourceForge. In that case the
--- 3,17 ----
convert PEP's to (X)HTML - courtesy of /F
! Usage: %(PROGRAM)s [options] [peps]
+ Notes:
+
+ The optional argument peps can be either pep numbers or .txt files.
+
Options:
+ -u/--user
+ SF username
+
-i/--install
After generating the HTML, install it SourceForge. In that case the
***************
*** 145,148 ****
--- 152,168 ----
os.chmod(outfile, 0664)
+
+ def find_pep(pep_str):
+ """Find the .txt file indicated by a cmd line argument"""
+ if os.path.exists(pep_str):
+ return pep_str
+ num = int(pep_str)
+ return "pep-%04d.txt" % num
+
+ def make_html(file):
+ newfile = os.path.splitext(file)[0] + ".html"
+ print file, "->", newfile
+ fixfile(file, newfile)
+ return newfile
***************
*** 157,166 ****
usage(1, msg)
- if args:
- username = args[0] + '@'
- del args[0]
- if args:
- usage(1, 'unexpected arguments')
-
for opt, arg in opts:
if opt in ('-h', '--help'):
--- 177,180 ----
***************
*** 168,179 ****
elif opt in ('-i', '--install'):
update = 1
! for file in glob.glob("pep-*.txt"):
! newfile = os.path.splitext(file)[0] + ".html"
! print file, "->", newfile
! fixfile(file, newfile)
if update:
- os.system("scp pep-*.html style.css " + username + HOST + ":" + HDIR)
os.system("ssh " + username + HOST + " chmod 664 " + HDIR + "/*")
--- 182,205 ----
elif opt in ('-i', '--install'):
update = 1
+ elif opt in ('-u', '--user'):
+ username = arg + "@"
! if args:
! html = []
! for pep in args:
! file = find_pep(pep)
! newfile = make_html(file)
! html.append(newfile)
! os.system("scp %s style.css " % " ".join(html) \
! + username + HOST + ":" + HDIR)
! else:
! # do them all
! for file in glob.glob("pep-*.txt"):
! make_html(file)
! if update:
! os.system("scp pep-*.html style.css " + \
! username + HOST + ":" + HDIR)
if update:
os.system("ssh " + username + HOST + " chmod 664 " + HDIR + "/*")