--- /usr/bin/wrap-and-sort 2017-06-13 23:57:39.056093263 +0100
+++ /home/gsilva/Documents/wrap-and-sort 2017-06-13 23:38:01.224067941 +0100
@@ -87,9 +87,7 @@ class WrapAndSortControl(Control):
if sort_paragraphs:
first = self.paragraphs[:1 + int(keep_first)]
- print(first)
sortable = self.paragraphs[1 + int(keep_first):]
- print(sortable)
self.paragraphs = first + sorted(sortable, key=operator.itemgetter("Package"))
def _wrap_field(self, control, entry, wrap_always, short_indent,
@@ -97,17 +95,14 @@ class WrapAndSortControl(Control):
# An empty element is not explicitly disallowed by Policy but known to
# break QA tools, so remove any
packages = [x.strip() for x in control[entry].split(",") if x.strip()]
- print(packages)
# Sanitize alternative packages. E.g. "a|b |c" -> "a | b | c"
packages = [" | ".join([x.strip() for x in p.split("|")]) for p in packages]
- print(packages)
if sort:
# Remove duplicate entries
packages = set(packages)
packages = sort_list(packages)
- print(packages)
length = len(entry) + sum([2 + len(package) for package in packages])
if wrap_always or length > self.max_line_length:
@@ -164,9 +159,7 @@ def remove_trailing_whitespaces(filename
def sort_list(unsorted_list):
packages = [x for x in unsorted_list if re.match("[a-z0-9]", x)]
- print(packages())
special = [x for x in unsorted_list if not re.match("[a-z0-9]", x)]
- print(special)
return sorted(packages) + sorted(special)
@@ -176,7 +169,6 @@ def wrap_and_sort(options):
if options.verbose:
print(control_file)
control = WrapAndSortControl(control_file, options.max_line_length)
- print(control)
if options.cleanup:
control.strip_trailing_spaces()
control.wrap_and_sort(options.wrap_always, options.short_indent,
@@ -199,7 +191,6 @@ def wrap_and_sort(options):
install = Install(install_file)
install.sort()
install.save()
- print(install)
def get_files(debian_directory):
@@ -209,19 +200,14 @@ def get_files(debian_directory):
file_pattern = os.path.join(debian_directory, supported_files)
files.extend(file_name for file_name in glob.glob(file_pattern)
if not os.access(file_name, os.X_OK))
- print(files)
return files
-
def main():
script_name = os.path.basename(sys.argv[0])
usage = "%s [options]" % (script_name)
- print(usage)
epilog = "See %s(1) for more info." % (script_name)
- print(epilog)
parser = optparse.OptionParser(usage=usage, epilog=epilog)
- print(parser)
parser.add_option("-a", "--wrap-always", action="store_true", default=False,
help="wrap lists even if they do not exceed the line length limit")