mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
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.
This commit is contained in:
parent
30e56c0237
commit
213ef3ee56
2 changed files with 16 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python -B
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Run me like this: ./create_manpage_completions.py /usr/share/man/man{1,8}/* > man_completions.fish
|
# 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:
|
except UnicodeEncodeError:
|
||||||
pass
|
pass
|
||||||
return s.decode('latin-1', 'ignore')
|
return s.decode('latin-1', 'ignore')
|
||||||
|
|
||||||
|
|
||||||
def output_complete_command(cmdname, args, description, output_list):
|
def output_complete_command(cmdname, args, description, output_list):
|
||||||
comps = ['complete -c', cmdname]
|
comps = ['complete -c', cmdname]
|
||||||
|
@ -163,31 +163,31 @@ def built_command(options, description):
|
||||||
else:
|
else:
|
||||||
ELLIPSIS_CODE_POINT = 0x2026
|
ELLIPSIS_CODE_POINT = 0x2026
|
||||||
truncation_suffix = unichr(ELLIPSIS_CODE_POINT)
|
truncation_suffix = unichr(ELLIPSIS_CODE_POINT)
|
||||||
|
|
||||||
# Try to include as many whole sentences as will fit
|
# Try to include as many whole sentences as will fit
|
||||||
# Clean up some probably bogus escapes in the process
|
# Clean up some probably bogus escapes in the process
|
||||||
clean_desc = description.replace("\\'", "'").replace("\\.", ".")
|
clean_desc = description.replace("\\'", "'").replace("\\.", ".")
|
||||||
sentences = clean_desc.split('.')
|
sentences = clean_desc.split('.')
|
||||||
|
|
||||||
# Clean up "sentences" that are just whitespace
|
# Clean up "sentences" that are just whitespace
|
||||||
# But don't let it be empty
|
# But don't let it be empty
|
||||||
sentences = [x for x in sentences if x.strip()]
|
sentences = [x for x in sentences if x.strip()]
|
||||||
if not sentences: sentences = ['']
|
if not sentences: sentences = ['']
|
||||||
|
|
||||||
udot = lossy_unicode('.')
|
udot = lossy_unicode('.')
|
||||||
uspace = lossy_unicode(' ')
|
uspace = lossy_unicode(' ')
|
||||||
|
|
||||||
truncated_description = lossy_unicode(sentences[0]) + udot
|
truncated_description = lossy_unicode(sentences[0]) + udot
|
||||||
for line in sentences[1:]:
|
for line in sentences[1:]:
|
||||||
if not line: continue
|
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:
|
if len(proposed_description) <= max_description_width:
|
||||||
# It fits
|
# It fits
|
||||||
truncated_description = proposed_description
|
truncated_description = proposed_description
|
||||||
else:
|
else:
|
||||||
# No fit
|
# No fit
|
||||||
break
|
break
|
||||||
|
|
||||||
# If the first sentence does not fit, truncate if necessary
|
# If the first sentence does not fit, truncate if necessary
|
||||||
if len(truncated_description) > max_description_width:
|
if len(truncated_description) > max_description_width:
|
||||||
prefix_len = max_description_width - len(truncation_suffix)
|
prefix_len = max_description_width - len(truncation_suffix)
|
||||||
|
@ -504,7 +504,7 @@ class TypeDarwinManParser(ManParser):
|
||||||
# Skip leading groff crud
|
# Skip leading groff crud
|
||||||
while re.match('[A-Z][a-z]\s', line):
|
while re.match('[A-Z][a-z]\s', line):
|
||||||
line = line[3:]
|
line = line[3:]
|
||||||
|
|
||||||
# If the line ends with a space and then a period or comma, then erase the space
|
# 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 .'
|
# This hack handles lines of the form '.Ar projectname .'
|
||||||
if line.endswith(' ,') or line.endswith(' .'):
|
if line.endswith(' ,') or line.endswith(' .'):
|
||||||
|
@ -551,10 +551,10 @@ class TypeDarwinManParser(ManParser):
|
||||||
|
|
||||||
# Get the line and clean it up
|
# Get the line and clean it up
|
||||||
line = lines.pop(0)
|
line = lines.pop(0)
|
||||||
|
|
||||||
# Try to guess how many dashes this argument has
|
# Try to guess how many dashes this argument has
|
||||||
dash_count = self.count_argument_dashes(line)
|
dash_count = self.count_argument_dashes(line)
|
||||||
|
|
||||||
line = self.groff_replace_escapes(line)
|
line = self.groff_replace_escapes(line)
|
||||||
line = self.trim_groff(line)
|
line = self.trim_groff(line)
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
@ -661,7 +661,7 @@ def file_is_overwritable(path):
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# Remove any and all autogenerated completions in the given directory
|
# Remove any and all autogenerated completions in the given directory
|
||||||
def cleanup_autogenerated_completions_in_directory(dir):
|
def cleanup_autogenerated_completions_in_directory(dir):
|
||||||
try:
|
try:
|
||||||
|
@ -895,7 +895,7 @@ if __name__ == "__main__":
|
||||||
print(err.msg) # will print something like "option -a not recognized"
|
print(err.msg) # will print something like "option -a not recognized"
|
||||||
usage(script_name)
|
usage(script_name)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
# Directories within which we will clean up autogenerated completions
|
# Directories within which we will clean up autogenerated completions
|
||||||
# This script originally wrote completions into ~/.config/fish/completions
|
# This script originally wrote completions into ~/.config/fish/completions
|
||||||
# Now it writes them into a separate directory
|
# Now it writes them into a separate directory
|
||||||
|
@ -935,7 +935,7 @@ if __name__ == "__main__":
|
||||||
if not file_paths:
|
if not file_paths:
|
||||||
print("No paths specified")
|
print("No paths specified")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if not WRITE_TO_STDOUT and not output_directory:
|
if not WRITE_TO_STDOUT and not output_directory:
|
||||||
# Default to ~/.local/share/fish/generated_completions/
|
# Default to ~/.local/share/fish/generated_completions/
|
||||||
# Create it if it doesn't exist
|
# Create it if it doesn't exist
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python -B
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
""" Deroff.py, ported to Python from the venerable deroff.c """
|
""" Deroff.py, ported to Python from the venerable deroff.c """
|
||||||
|
|
Loading…
Reference in a new issue