Remove Subversion metadata
These files were committed accidentally.
This commit is contained in:
parent
c2251f3022
commit
c861995515
164 changed files with 0 additions and 21568 deletions
|
@ -1,11 +0,0 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 67
|
||||
/repos/product-security/!svn/ver/288/defensive-coding/trunk/scripts
|
||||
END
|
||||
split-snippets.py
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 85
|
||||
/repos/product-security/!svn/ver/288/defensive-coding/trunk/scripts/split-snippets.py
|
||||
END
|
|
@ -1,62 +0,0 @@
|
|||
10
|
||||
|
||||
dir
|
||||
305
|
||||
https://svn.devel.redhat.com/repos/product-security/defensive-coding/trunk/scripts
|
||||
https://svn.devel.redhat.com/repos/product-security
|
||||
|
||||
|
||||
|
||||
2012-12-14T09:21:42.199416Z
|
||||
288
|
||||
fweimer@REDHAT.COM
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
9bd5cf0f-f2b3-0410-b1a9-d5c590f50bf1
|
||||
|
||||
split-snippets.py
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2013-01-10T17:17:49.053814Z
|
||||
a3a947246ad0000e1e2f3836674da5ce
|
||||
2012-12-14T09:21:42.199416Z
|
||||
288
|
||||
fweimer@REDHAT.COM
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3637
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Split source code files into XML snippets for inclusion in the
|
||||
# documentation.
|
||||
#
|
||||
# Usage: python split-snippets.py TARGET-ROOT INPUT-FILE...
|
||||
#
|
||||
# Directives in the input files have the form:
|
||||
#
|
||||
# //+ Directory File-Base-Name
|
||||
# lines to be included in
|
||||
# the file
|
||||
# //-
|
||||
#
|
||||
# In this example, the lines are written to the file
|
||||
# en-US/Directory/snippets/File-Base-Name.xml under the TARGET-ROOT
|
||||
# directory. Whitespace shared with the starting line is stripped.
|
||||
# Instead of "//", it is possible to use "#".
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
target_root = sys.argv[1]
|
||||
|
||||
def output_file_name(dirname, basename):
|
||||
return "{0}/en-US/{1}/snippets/{2}.xml".format(
|
||||
target_root, dirname, basename)
|
||||
|
||||
re_open_file = re.compile(
|
||||
r'^(\s*)(?://|#)\+\s+([a-zA-Z0-9_-]+)\s+([a-zA-Z0-9_-]+)\s*\n?$')
|
||||
re_close_file = re.compile(r'^\s*(?://|#)\-\s*\n?$')
|
||||
|
||||
def extension_to_language(path, map={
|
||||
'c' : 'C',
|
||||
'py' : 'Python',
|
||||
'java' : 'Java',
|
||||
}):
|
||||
return map.get(path.split('.')[-1], 'C')
|
||||
|
||||
def write_single_file(path, contents, language):
|
||||
assert not [ch for ch in language if ch in "<>&\""]
|
||||
with file(path, "w") as out:
|
||||
out.write('''<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE programlisting PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
]>
|
||||
<!-- Automatically generated file. Do not edit. -->
|
||||
<programlisting language="''' + language + '''">
|
||||
''')
|
||||
for line in contents:
|
||||
for ch in line:
|
||||
if ch in "<>&":
|
||||
out.write("&#{0};".format(ord(ch)))
|
||||
else:
|
||||
out.write(ch)
|
||||
out.write("</programlisting>\n")
|
||||
|
||||
def write_output(output):
|
||||
for (outpath, (origpath, contents)) in output.items():
|
||||
write_single_file(outpath, contents,
|
||||
extension_to_language(origpath))
|
||||
|
||||
def process_file(path):
|
||||
output = {}
|
||||
with file(path) as f:
|
||||
current_file = None
|
||||
current_contents = None
|
||||
indent = None
|
||||
for line in f.readlines():
|
||||
match = re_open_file.match(line)
|
||||
if match is not None:
|
||||
if current_file is None:
|
||||
current_file = output_file_name(
|
||||
match.group(2), match.group(3))
|
||||
if current_file in output:
|
||||
raise IOError("{0} written by {1} and {2}",
|
||||
current_file, output[current_file][0],
|
||||
path)
|
||||
indent = match.group(1)
|
||||
current_contents = []
|
||||
output[current_file] = (path, current_contents)
|
||||
else:
|
||||
raise IOError("{0}: unterminated export to {1}".format(
|
||||
path, current_file))
|
||||
continue
|
||||
|
||||
match = re_close_file.match(line)
|
||||
if match is not None:
|
||||
if current_file is None:
|
||||
raise IOError("{0}: closing file which is not open")
|
||||
else:
|
||||
current_file = None
|
||||
current_contents = None
|
||||
indent = None
|
||||
continue
|
||||
|
||||
if current_file is not None:
|
||||
if line.startswith(indent):
|
||||
line = line[len(indent):]
|
||||
current_contents.append(line)
|
||||
if current_file is not None:
|
||||
raise IOError("{0}: unterminated export to {1}".format(
|
||||
path, current_file))
|
||||
write_output(output)
|
||||
|
||||
for path in sys.argv[2:]:
|
||||
process_file(path)
|
Loading…
Add table
Add a link
Reference in a new issue