From 213ef3ee561de1a25b065203175bf5896f01dba7 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Sun, 9 Oct 2016 14:11:04 -0700 Subject: [PATCH] don't produce *.pyc files Producing man pages is done infrequently (basically just at `make test` and `make install`) so there isn't any point in writing compiled byte-code versions of the python modules. --- share/tools/create_manpage_completions.py | 30 +++++++++++------------ share/tools/deroff.py | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py index 87c9b93b8..b8b3aa104 100755 --- a/share/tools/create_manpage_completions.py +++ b/share/tools/create_manpage_completions.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python -B # -*- coding: utf-8 -*- # Run me like this: ./create_manpage_completions.py /usr/share/man/man{1,8}/* > man_completions.fish @@ -115,7 +115,7 @@ def lossy_unicode(s): except UnicodeEncodeError: pass return s.decode('latin-1', 'ignore') - + def output_complete_command(cmdname, args, description, output_list): comps = ['complete -c', cmdname] @@ -163,31 +163,31 @@ def built_command(options, description): else: ELLIPSIS_CODE_POINT = 0x2026 truncation_suffix = unichr(ELLIPSIS_CODE_POINT) - + # Try to include as many whole sentences as will fit # Clean up some probably bogus escapes in the process clean_desc = description.replace("\\'", "'").replace("\\.", ".") sentences = clean_desc.split('.') - + # Clean up "sentences" that are just whitespace # But don't let it be empty sentences = [x for x in sentences if x.strip()] if not sentences: sentences = [''] udot = lossy_unicode('.') - uspace = lossy_unicode(' ') - - truncated_description = lossy_unicode(sentences[0]) + udot + uspace = lossy_unicode(' ') + + truncated_description = lossy_unicode(sentences[0]) + udot for line in sentences[1:]: if not line: continue - proposed_description = lossy_unicode(truncated_description) + uspace + lossy_unicode(line) + udot + proposed_description = lossy_unicode(truncated_description) + uspace + lossy_unicode(line) + udot if len(proposed_description) <= max_description_width: # It fits truncated_description = proposed_description else: # No fit break - + # If the first sentence does not fit, truncate if necessary if len(truncated_description) > max_description_width: prefix_len = max_description_width - len(truncation_suffix) @@ -504,7 +504,7 @@ class TypeDarwinManParser(ManParser): # Skip leading groff crud while re.match('[A-Z][a-z]\s', line): line = line[3:] - + # If the line ends with a space and then a period or comma, then erase the space # This hack handles lines of the form '.Ar projectname .' if line.endswith(' ,') or line.endswith(' .'): @@ -551,10 +551,10 @@ class TypeDarwinManParser(ManParser): # Get the line and clean it up line = lines.pop(0) - + # Try to guess how many dashes this argument has dash_count = self.count_argument_dashes(line) - + line = self.groff_replace_escapes(line) line = self.trim_groff(line) line = line.strip() @@ -661,7 +661,7 @@ def file_is_overwritable(path): file.close() return result - + # Remove any and all autogenerated completions in the given directory def cleanup_autogenerated_completions_in_directory(dir): try: @@ -895,7 +895,7 @@ if __name__ == "__main__": print(err.msg) # will print something like "option -a not recognized" usage(script_name) sys.exit(2) - + # Directories within which we will clean up autogenerated completions # This script originally wrote completions into ~/.config/fish/completions # Now it writes them into a separate directory @@ -935,7 +935,7 @@ if __name__ == "__main__": if not file_paths: print("No paths specified") sys.exit(0) - + if not WRITE_TO_STDOUT and not output_directory: # Default to ~/.local/share/fish/generated_completions/ # Create it if it doesn't exist diff --git a/share/tools/deroff.py b/share/tools/deroff.py index 214f2815a..02ba52538 100755 --- a/share/tools/deroff.py +++ b/share/tools/deroff.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python -B # -*- coding: utf-8 -*- """ Deroff.py, ported to Python from the venerable deroff.c """