mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix setup commands help messages
This commit is contained in:
parent
039aab161c
commit
1ce7847d8d
5
setup.py
5
setup.py
@ -42,9 +42,8 @@ def main(args=sys.argv):
|
||||
|
||||
parser = option_parser()
|
||||
command.add_all_options(parser)
|
||||
lines = parser.usage.splitlines()
|
||||
lines[0] = 'Usage: python setup.py %s [options]'%args[1]
|
||||
parser.set_usage('\n'.join(lines))
|
||||
parser.set_usage('Usage: python setup.py %s [options]\n\n'%args[1]+\
|
||||
command.description)
|
||||
|
||||
opts, args = parser.parse_args(args)
|
||||
command.run_all(opts)
|
||||
|
@ -11,7 +11,7 @@ __all__ = [
|
||||
'build',
|
||||
'gui',
|
||||
'develop',
|
||||
'clean'
|
||||
'clean', 'clean_backups',
|
||||
]
|
||||
|
||||
import os, shutil
|
||||
@ -32,6 +32,22 @@ develop = Develop()
|
||||
from setup.gui import GUI
|
||||
gui = GUI()
|
||||
|
||||
class CleanBackups(Command):
|
||||
|
||||
description='Delete all backup files in the calibre source tree'
|
||||
|
||||
def clean(self):
|
||||
return self.run(None)
|
||||
|
||||
def run(self, opts=None):
|
||||
for root, _, files in os.walk(self.d(self.SRC)):
|
||||
for name in files:
|
||||
for t in ('.pyc', '.pyo', '~', '.swp', '.swo'):
|
||||
if name.endswith(t):
|
||||
os.remove(os.path.join(root, name))
|
||||
|
||||
clean_backups = CleanBackups()
|
||||
|
||||
class Clean(Command):
|
||||
|
||||
description='''Delete all computer generated files in the source tree'''
|
||||
@ -55,13 +71,6 @@ class Clean(Command):
|
||||
cmd.clean()
|
||||
|
||||
def clean(self):
|
||||
for root, _, files in os.walk(self.d(self.SRC)):
|
||||
for name in files:
|
||||
for t in ('.pyc', '.pyo', '~', '.swp', '.swo'):
|
||||
if name.endswith(t):
|
||||
os.remove(os.path.join(root, name))
|
||||
break
|
||||
|
||||
for dir in ('dist', os.path.join('src', 'calibre.egg-info')):
|
||||
shutil.rmtree(dir, ignore_errors=True)
|
||||
|
||||
|
@ -157,9 +157,7 @@ if iswindows:
|
||||
|
||||
class Build(Command):
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.set_usage(parser.usage + textwrap.dedent('''
|
||||
|
||||
description = textwrap.dedent('''\
|
||||
calibre depends on several python extensions written in C/C++.
|
||||
This command will compile them. You can influence the compile
|
||||
process by several environment variables, listed below:
|
||||
@ -179,9 +177,11 @@ class Build(Command):
|
||||
PODOFO_LIB_DIR - podofo library files
|
||||
|
||||
QMAKE - Path to qmake
|
||||
VS90COMNTOOLS - Location of Microsoft Visual Studio 9 Tools
|
||||
VS90COMNTOOLS - Location of Microsoft Visual Studio 9 Tools (windows only)
|
||||
|
||||
'''))
|
||||
''')
|
||||
|
||||
def add_options(self, parser):
|
||||
choices = [e.name for e in extensions]+['all']
|
||||
parser.add_option('-1', '--only', choices=choices, default='all',
|
||||
help=('Build only the named extension. Available: '+
|
||||
|
@ -30,21 +30,18 @@ sys.exit({func!s}())
|
||||
|
||||
class Develop(Command):
|
||||
|
||||
description = 'Setup a development environment'
|
||||
description = textwrap.dedent('''\
|
||||
Setup a development environment for calibre.
|
||||
This allows you to run calibre directly from the source tree.
|
||||
Binaries will be installed in <prefix>/bin where <prefix> is
|
||||
the prefix of your python installation. This can be controlled
|
||||
via the --prefix option.
|
||||
''')
|
||||
MODE = 0755
|
||||
|
||||
sub_commands = ['build', 'translations']
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.set_usage(textwrap.dedent('''\
|
||||
***
|
||||
|
||||
Setup a development environment for calibre.
|
||||
This allows you to run calibre directly from the source tree.
|
||||
Binaries will be installed in <prefix>/bin where <prefix> is
|
||||
the prefix of your python installation. This can be controlled
|
||||
via the --prefix option.
|
||||
'''))
|
||||
parser.add_option('--prefix',
|
||||
help='Binaries will be installed in <prefix>/bin')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user