/usr/share/pyshared/libtiff/script_options.py is in python-libtiff 0.3.0~svn78-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | __all__ = ['set_formatter', 'set_info_options', 'set_convert_options']
import os
from optparse import OptionGroup, NO_DEFAULT
from optparse import TitledHelpFormatter
class MyHelpFormatter(TitledHelpFormatter):
def format_option(self, option):
old_help = option.help
default = option.default
if isinstance (default, str) and ' ' in default:
default = repr (default)
if option.help is None:
option.help = 'Specify a %s.' % (option.type)
if option.type=='choice':
choices = []
for choice in option.choices:
if choice==option.default:
if ' ' in choice:
choice = repr(choice)
choice = '['+choice+']'
else:
if ' ' in choice:
choice = repr(choice)
choices.append (choice)
option.help = '%s Choices: %s.'% (option.help, ', '.join(choices))
else:
if default != NO_DEFAULT:
if option.action=='store_false':
option.help = '%s Default: %s.'% (option.help, not default)
else:
option.help = '%s Default: %s.'% (option.help, default)
result = TitledHelpFormatter.format_option (self, option)
option.help = old_help
return result
help_formatter = MyHelpFormatter()
def set_formatter(parser):
"""Set customized help formatter.
"""
parser.formatter = help_formatter
def set_convert_options(parser):
set_formatter(parser)
if os.name == 'posix':
try:
import matplotlib
matplotlib.use('GTkAgg')
parser.run_methods = ['subcommand']
except ImportError:
pass
parser.set_usage ('%prog [options] -i INPUTPATH [-o OUTPUTPATH]')
parser.set_description('Convert INPUTPATH to OUTPUTPATH.')
parser.add_option ('--input-path', '-i',
type = 'file', metavar='INPUTPATH',
help = 'Specify INPUTPATH.'
)
parser.add_option ('--output-path', '-o',
type = 'file', metavar='OUTPUTPATH',
help = 'Specify OUTPUTPATH.'
)
parser.add_option ('--compression',
type = 'choice', default='none',
choices = ['none', 'lzw'],
help = 'Specify compression.'
)
parser.add_option ('--slice',
type = 'string',
help = 'Specify slice using form "<zstart>:<zend>,<ystart>:<yend>,<xstart>:<xend>"'
)
def set_info_options(parser):
set_formatter(parser)
if os.name == 'posix':
try:
import matplotlib
matplotlib.use('GTkAgg')
parser.run_methods = ['subcommand']
except ImportError:
pass
parser.set_usage ('%prog [options] -i INPUTPATH')
parser.set_description('Show INPUTPATHs information.')
parser.add_option ('--input-path', '-i',
type = 'file', metavar='INPUTPATH',
help = 'Specify INPUTPATH.'
)
parser.add_option ('--memory-usage',
action = 'store_true', default=False,
help = 'Show TIFF file memory usage.'
)
parser.add_option ('--no-memory-usage', dest='memory_usage',
action = 'store_false',
help = 'See --memory-usage.'
)
parser.add_option ('--ifd',
action = 'store_true', default=False,
help = 'Show all TIFF file image file directory. By default, only the first IFD is shown.'
)
parser.add_option ('--no-ifd', dest='ifd',
action = 'store_false', help='See --ifd.')
parser.add_option ('--human',
action = 'store_true', default=False,
help = 'Show human readable values'
)
parser.add_option ('--no-human', dest='human',
action = 'store_false', help='See --human.')
|