aboutsummaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-25 23:05:14 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-25 23:05:14 +0200
commit726b63e97ded46b0b2340f3477af6ff08f5149ae (patch)
tree6a1f418dfb7f0b3bb54051972736d89148f6be22 /setup.py
parent1f409609b57dd86693371a4bedfe3a1e8ebba3e8 (diff)
downloadponysay-726b63e97ded46b0b2340f3477af6ff08f5149ae.tar.gz
ponysay-726b63e97ded46b0b2340f3477af6ff08f5149ae.tar.bz2
ponysay-726b63e97ded46b0b2340f3477af6ff08f5149ae.zip
fixes and conf veiwing
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py112
1 files changed, 78 insertions, 34 deletions
diff --git a/setup.py b/setup.py
index ddb7212..00be23c 100755
--- a/setup.py
+++ b/setup.py
@@ -15,16 +15,16 @@ PONYSAY_VERSION = '2.5'
#'en' must be first for manpages
#'ponies' must be first for sharedirs
-manpages = (('en', 'English'), ('es', 'Spanish'))
-sharedirs = (('ponies', 'xterm ponies', 'PONYDIR'), ('ttyponies', 'tty ponies', 'TTYPONYDIR'),
+manpages = [('en', 'English'), ('es', 'Spanish')]
+sharedirs = [('ponies', 'xterm ponies', 'PONYDIR'), ('ttyponies', 'tty ponies', 'TTYPONYDIR'),
('extraponies', 'extra xterm ponies', 'XPONYDIR'), ('extrattyponies', 'extra tty ponies', 'XTTYPONYDIR'),
- ('quotes', 'pony quotes', 'QUOTEDIR'), ('balloons', 'balloon styles', 'BALLOONDIR'))
-sharefiles = (('ucs', 'ucsmap'))
-commands = ('ponysay', 'ponythink')
-shells = (('bash', '/usr/share/bash-completion/completions/ponysay', 'GNU Bash'),
+ ('quotes', 'pony quotes', 'QUOTEDIR'), ('balloons', 'balloon styles', 'BALLOONDIR')]
+sharefiles = [('ucs', 'ucsmap')]
+commands = ['ponysay', 'ponythink']
+shells = [('bash', '/usr/share/bash-completion/completions/ponysay', 'GNU Bash'),
('fish', '/usr/share/fish/completions/ponysay.fish', 'Friendly interactive shell'),
- ('zsh', '/usr/share/zsh/site-functions/_ponysay', 'zsh'))
-mansections = (('ponysay', '6'), ('cowsay', '1'), ('fortune', '6'))
+ ('zsh', '/usr/share/zsh/site-functions/_ponysay', 'zsh')]
+mansections = [('ponysay', '6'), ('cowsay', '1'), ('fortune', '6')]
@@ -63,8 +63,8 @@ class Setup():
for shell in shells:
opts.add_argumentless(help = 'Do not install completion for ' + shell[2], alternatives = ['--without-' + shell[0]])
opts.add_argumented (help = 'Set file name for the completion for ponysay in' + shell[2], alternatives = [ '--with-' + shell[0]], arg='PONYSAY_%s_FILE' % (shell[0].upper()))
- opts.add_argumentless(help = 'Only install explicitly included shell completions', alternatives = ['--without-shells'])
- opts.add_argumented (help = 'Set share/ directory used for shell completions\nDefault = $SHAREDIR', alternatives = [ '--with-shells'], arg='SHAREDIR')
+ opts.add_argumentless(help = 'Only install explicitly included shell completions', alternatives = ['--without-shell'])
+ opts.add_argumented (help = 'Set share/ directory used for shell completions\nDefault = $SHAREDIR', alternatives = [ '--with-shell'], arg='SHAREDIR')
opts.add_argumentless(help = 'Do not install PDF manual\nDefault', alternatives = ['--without-pdf'])
opts.add_argumented (help = 'Set directory for PDF manual\nDefault = $PREFIX/doc', alternatives = [ '--with-pdf'], arg='DOCDIR')
@@ -123,15 +123,62 @@ class Setup():
opts.files = ['build']
method = opts.files[0]
conf = self.configure(opts.opts)
- if method == 'build': Setup.build (conf)
- elif method == 'prebuilt': Setup.install (conf)
- elif method == 'install': Setup.build (conf); Setup.install(conf)
- elif method == 'uninstall': Setup.uninstall (conf)
- elif method == 'uninstall-old': Setup.uninstallOld(conf)
- elif method == 'clean': Setup.clean (conf)
- elif method == 'clean-old': Setup.cleanOld (conf)
- else:
- opts.help()
+ self.viewconf(conf)
+ #if method == 'build': Setup.build (conf)
+ #elif method == 'prebuilt': Setup.install (conf)
+ #elif method == 'install': Setup.build (conf); Setup.install(conf)
+ #elif method == 'uninstall': Setup.uninstall (conf)
+ #elif method == 'uninstall-old': Setup.uninstallOld(conf)
+ #elif method == 'clean': Setup.clean (conf)
+ #elif method == 'clean-old': Setup.cleanOld (conf)
+ #else:
+ # opts.help()
+
+
+ '''
+ Display configurations
+ '''
+ def viewconf(self, conf):
+ RED = '\033[31m%s\033[39m'
+ GREEN = '%s\033[32m%s\033[39m'
+ YELLOW = '\033[33m%s\033[39m'
+
+ for command in commands:
+ if conf[command]: print(GREEN % ('', 'Installing command ' + command))
+ else: print(RED % ('Skipping installion of command ' + command))
+ if conf['shared-cache'] is not None: print(GREEN % ('Installing shared cache at ', conf['shared-cache']))
+ else: print(RED % ('Skipping installation of shared cache'))
+ for shell in [item[0] for item in shells]:
+ if conf[shell] is not None: print(GREEN % ('Installing auto-completion for ' + shell + ' to', conf[shell]))
+ else: print(RED % ('Skipping installation of auto-completion for ' + shell))
+ if conf['pdf'] is not None: print(GREEN % ('Installing PDF manual to ', conf['pdf']))
+ else: print(RED % ('Skipping installation of PDF manual'))
+ if conf['pdf-compression'] is not None: print(GREEN % ('Compressing PDF manual with ', conf['pdf-compression']))
+ else: print(RED % ('Skipping compression of PDF manual'))
+ if conf['info'] is not None: print(GREEN % ('Installing info manual to ', conf['info']))
+ else: print(RED % ('Skipping installation of info manual'))
+ if conf['info-install'] is not None: print(GREEN % ('Installing info manual with install-info with description ', conf['info-install']))
+ else: print(RED % ('Skipping installation of info manual with install-info'))
+ if conf['info-compression'] is not None: print(GREEN % ('Compressing info manual with ', conf['info-compression']))
+ else: print(RED % ('Skipping compression of info manual'))
+ for man in manpages:
+ key = 'man-' + man[0]
+ if conf[key] is not None: print(GREEN % ('Installing ' + man[1] + ' manpage to ', conf[key]))
+ else: print(RED % ('Skipping installation of ' + man[1] + ' manpage'))
+ key += '-compression'
+ if conf[key] is not None: print(GREEN % ('Compressing ' + man[1] + ' manpage with ', conf[key]))
+ else: print(RED % ('Skipping compression of ' + man[1] + ' manpage'))
+ for man in mansections: print(GREEN % ('References to manpage for ' + man[1] + ' points to section ', conf['man-section-' + man[0]]))
+ for dir in sharedirs:
+ if conf[dir[0]] is not None: print(GREEN % ('Installing ' + dir[1] + ' to ', conf[dir[0]]))
+ else: print(RED % ('Skipping installation of ' + dir[1]))
+ for file in sharefiles:
+ if conf[file[0]] is not None: print(GREEN % ('Installing ' + file[1] + ' as ', conf[file[0]]))
+ else: print(RED % ('Skipping installation of ' + file[1]))
+ if conf['custom-env-python'] is not None: print(GREEN % ('Using custom env reference in python script shebang: ', conf['custom-env-python']))
+ else: print(YELLOW % ('Looking for best env reference in python script shebang'))
+
+ print()
'''
@@ -177,30 +224,27 @@ class Setup():
if opts['--share-dir'] is None: opts['--share-dir'] = ['/opt/ponysay/share']
if conf['shared-cache'] is None: opts['shared-cache'] = ['/var/opt/ponysay/cache']
- for dir in ('bin', 'lib', 'share'):
+ for dir in ['bin', 'lib', 'share']:
if opts['--' + dir + '-dir'] is not None:
d = opts['--' + dir + '-dir'][0]
for key in conf:
- if conf.startswith(prefix + '/' + dir):
- conf[key] = d + conf[key][5 + len(dir):]
+ if conf[key] not in [None, True, False]:
+ if conf[key].startswith(prefix + '/' + dir):
+ conf[key] = d + conf[key][5 + len(dir):]
if opts['--cache-dir'] is not None:
dir = opts['--cache-dir'][0]
for key in conf:
if conf.startswith('/var/cache'):
conf[key] = d + conf[key][10:]
- for key in conf:
- defaults[key] = conf[key]
-
-
if opts['--nothing'] is not None:
opts['--minimal'] = opts['--nothing']
- for key in ('custom-env-python'):
+ for key in ['custom-env-python']:
conf[key] = None
if opts['--everything'] is not None:
- for key in ('pdf', 'pdf-compression'):
+ for key in ['pdf', 'pdf-compression']:
conf[key] = None
nomanen = opts['--minimal'] is not None
@@ -210,7 +254,7 @@ class Setup():
conf[key] = None
if (opts['--private'] is not None) or (opts['--minimal'] is not None):
- for key in ('info-install', 'shared-cache'):
+ for key in ['info-install', 'shared-cache']:
conf[key] = None
if opts['--minimal'] is not None:
@@ -225,10 +269,10 @@ class Setup():
conf[command] = True
- for coll in (('shell', '/usr/share', [item[0] for item in shells]),
- ('man', '/usr/share/man', ['man-' + item[0] for item in manpages]),
- ('man-compression', 'gz', ['man-' + item[0] + '-compression' for item in manpages])
- ):
+ for coll in [['shell', '/usr/share', [item[0] for item in shells]],
+ ['man', '/usr/share/man', ['man-' + item[0] for item in manpages]],
+ ['man-compression', 'gz', ['man-' + item[0] + '-compression' for item in manpages]]
+ ]:
if opts['--without-' + coll[0]] is not None:
for item in coll[2]:
conf[item] = None
@@ -245,7 +289,7 @@ class Setup():
if opts['--without-' + key] is not None:
conf[key] = False if defaults[key] in (False, True) else None
- for pair in (('pdf', 'pdf-compression'), ('info', 'info-install'), ('info', 'info-compression'), ('man-es', 'man-es-compression')):
+ for pair in [('pdf', 'pdf-compression'), ('info', 'info-install'), ('info', 'info-compression'), ('man-es', 'man-es-compression')]:
if (conf[pair[0]] in (False, None)) and (conf[pair[1]] not in (False, None)):
conf[pair[0]] = defaults[pair[0]]