Skip to content

Commit

Permalink
Small cleanups to the REP scripts. (#396)
Browse files Browse the repository at this point in the history
1.  Removes instances of /usr/bin/env python, which don't
    work on non-Linux and also were wrong in some cases.
2.  Makes sure to use raw strings for regexes, which gets
    rid of some warnings with modern Python.
3.  Uses '-f' when removing files to quite warnings.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Feb 29, 2024
1 parent eb6329e commit d8f3db1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ xsdvalid:
$(PYTHON) xsdValid.py

clean:
-rm *.html
-rm rep-0000.rst
-rm -f *.html
-rm -f rep-0000.rst

upload: all
rsync -r README.txt *.html mermaid.js css rep-0000.rst $(SUBDIRS) [email protected]:/var/www/www.ros.org/reps
1 change: 0 additions & 1 deletion genrepindex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python2.5
"""Auto-generate REP 0 (REP index).
Generating the REP index is a multi-step process. To begin, you must first
Expand Down
10 changes: 5 additions & 5 deletions rep2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
' "http://www.w3.org/TR/REC-html40/loose.dtd">')

fixpat = re.compile(
"((https?|ftp):[-_a-zA-Z0-9/.+~:?#$=&,]+)|(rep-\d+(.rst)?)|"
"(RFC[- ]?(?P<rfcnum>\d+))|"
"(REP\s+(?P<repnum>\d+))|"
r"((https?|ftp):[-_a-zA-Z0-9/.+~:?#$=&,]+)|(rep-\d+(.rst)?)|"
r"(RFC[- ]?(?P<rfcnum>\d+))|"
r"(REP\s+(?P<repnum>\d+))|"
".")

EMPTYSTRING = ''
Expand Down Expand Up @@ -220,7 +220,7 @@ def fixfile(inpath, input_lines, outfile):
for k, v in header:
if k.lower() in ('author', 'discussions-to'):
mailtos = []
for part in re.split(',\s*', v):
for part in re.split(r',\s*', v):
if '@' in part:
realname, addr = parseaddr(part)
if k.lower() == 'discussions-to':
Expand All @@ -236,7 +236,7 @@ def fixfile(inpath, input_lines, outfile):
v = COMMASPACE.join(mailtos)
elif k.lower() in ('replaces', 'replaced-by', 'requires'):
otherreps = ''
for otherrep in re.split(',?\s+', v):
for otherrep in re.split(r',?\s+', v):
otherrep = int(otherrep)
otherreps += '<a href="rep-%04d.html">%i</a> ' % (otherrep,
otherrep)
Expand Down
2 changes: 0 additions & 2 deletions xsdValid.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/python

import xmlschema

format1 = xmlschema.XMLSchema('xsd/package_format1.xsd')
Expand Down

0 comments on commit d8f3db1

Please sign in to comment.