This commit is contained in:
Kovid Goyal 2017-02-01 10:17:39 +05:30
parent 71e4857a47
commit 59a430f23a

View File

@ -8,11 +8,16 @@ __docformat__ = 'restructuredtext en'
import sys, os
def check_version_info():
vi = sys.version_info
if vi[0] == 2 and vi[1:3] >= (7, 9):
return None
raise SystemExit('calibre requires python >= 2.7.9 and < 3. Current python version: %s' % vi)
return
raise SystemExit(
'calibre requires python >= 2.7.9 and < 3. Current python version: %s'
% vi)
check_version_info()
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
@ -20,18 +25,30 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import setup.commands as commands
from setup import prints, get_warnings
def option_parser():
import optparse
parser = optparse.OptionParser()
parser.add_option('-c', '--clean', default=False, action='store_true',
parser.add_option(
'-c',
'--clean',
default=False,
action='store_true',
help=('Instead of running the command delete all files generated '
'by the command'))
parser.add_option('--clean-backups', default=False, action='store_true',
parser.add_option(
'--clean-backups',
default=False,
action='store_true',
help='Delete all backup files from the source tree')
parser.add_option('--clean-all', default=False, action='store_true',
parser.add_option(
'--clean-all',
default=False,
action='store_true',
help='Delete all machine generated files from the source tree')
return parser
def clean_backups():
for root, _, files in os.walk('.'):
for name in files:
@ -97,5 +114,6 @@ def main(args=sys.argv):
return 0
if __name__ == '__main__':
sys.exit(main())