From fe19d9132df2d4097847ebe2a3bda2787d1d988c Mon Sep 17 00:00:00 2001 From: ircnet Date: Mon, 14 Sep 2009 11:44:55 +0000 Subject: [PATCH] Use textwrap to wrap our lines to 80char, otherwise ircd cannot parse the long comments we use (beeth is aware) git-svn-id: svn+ssh://svn.ipng.nl/usr/share/subversion/repositories/ircnet.ipng.ch@38 c5d60b8d-fdcb-4146-b734-af4215e9eb71 --- ripedb/asset_ilines.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ripedb/asset_ilines.py b/ripedb/asset_ilines.py index af3272f..742941d 100755 --- a/ripedb/asset_ilines.py +++ b/ripedb/asset_ilines.py @@ -21,6 +21,7 @@ import os import getpass import socket import re +import textwrap def usage(): print """Usage: @@ -169,18 +170,15 @@ def main(): ofile.write("# File generated on %s by %s@%s\n" % (time.asctime(time.localtime(time.time())), getpass.getuser(), socket.gethostname())) -# TODO(pim): Make these lines wrap at ~80char because the ircd config -# parser cannot take long lines :( -# ofile.write("# Commandline: %s\n" % ' '.join(sys.argv)) -# ofile.write("# assets=%s asns=%s output=%s class=%s\n" % -# (','.join(_assets), ','.join(_asns), _output, _class)) - + ofile.write("# Commandline:\n# %s\n" % + ("\n# ".join(textwrap.wrap(' '.join(sys.argv))))) ofile.write("# Objects found: %d route/route6, %d ASn, %d as-set\n\n" % (len(all_route_list), len(_data['asn']), len(_assets))) -# for _asset in _data['as-set']: -# ofile.write("# %s: %s\n" % -# (_asset, ', '.join(_data['as-set'][_asset]))) + for _asset in _data['as-set']: + ofile.write("# %s:\n# %s\n" % + (_asset, "\n# ".join(textwrap.fill( + ', '.join(_data['as-set'][_asset]))))) ofile.write("#\n\n") output_linecount = 0