From 3a6ac727a536f33f89e30a36cc2310905904c25f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Sat, 1 Jun 2013 08:30:04 +0200 Subject: [PATCH] minor improvments to setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- setup.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 3ec7faf2..cd310c03 100755 --- a/setup.py +++ b/setup.py @@ -232,23 +232,24 @@ class Setup(): self.linking = SYMBOLIC if opts.opts['--linking'] is not None: self.linking = opts.opts['--linking'][0] - + self.free = None if opts.opts['--freedom'] is not None: if opts.opts['--freedom'][0].lower() in ('strict', 'full', 'true', 'yes'): self.free = True elif opts.opts['--freedom'][0].lower() in ('partial', 'sloppy', 'false', 'no'): self.free = False - if self.free is None: - if (opts.opts['--version'] is None) and ((len(opts.files) != 1) or (opts.files[0] != 'version')): - print('') - print('You need to select your freedom, add --freedom=strict or --freedom=partial.') - print('') - print('--freedom=strict will install only ponies that are completely free.') - print('--freedom=partial will install all ponies, even if they are not free.') - print('') - print('') - exit(255) + def checkFreedom(): + if force and (self.free is None): + if (opts.opts['--version'] is None) and ((len(opts.files) != 1) or (opts.files[0] != 'version')): + print('') + print('You need to select your freedom, add --freedom=strict or --freedom=partial.') + print('') + print('--freedom=strict will install only ponies that are completely free.') + print('--freedom=partial will install all ponies, even if they are not free.') + print('') + print('') + exit(255) if (opts.opts['---DESTDIR'] is not None) and (opts.opts['--dest-dir'] is None): destdir = opts.opts['---DESTDIR'][0] @@ -276,13 +277,16 @@ class Setup(): os.umask(0o022) if method == 'build': + checkFreedom() self.build(conf) elif method == 'prebuilt': + checkFreedom() self.applyDestDir(conf) self.install(conf) elif method == 'install': + checkFreedom() self.build(conf) self.applyDestDir(conf) self.install(conf) @@ -342,7 +346,9 @@ class Setup(): for miscfile in miscfiles: print(GREEN % ('Installing ' + miscfile[0] + ' to ', conf[miscfile[0]])) print('Using system configuration directory: ' + conf['sysconf-dir']) print('Prefered linking style: ' + self.linking) - if self.free: print(GREEN % ('', 'Installing only fully free parts of the package')) + print('Using umask: 022 (only owner can do modifications)') + if self.free is None: print(YELLOW % ('\033[01m--freedom is manditory and has not be specified\033[21m')) + elif self.free: print(GREEN % ('', 'Installing only fully free parts of the package')) else: print(RED % ('Installing \033[1mnot\033[21m only fully free parts of the package')) print() @@ -1167,7 +1173,7 @@ class ArgParser(): if opt_help is not None: for opt_alt in opt_alts: if opt_alt is opt_alts[-1]: - print('\t%s \033[4m%s\033[24m' % (opt_alt, opt_arg) if opt_type == ARGUMENTED else '\t' + opt_alt) + print('\t%s=\033[4m%s\033[24m' % (opt_alt, opt_arg) if opt_type == ARGUMENTED else '\t' + opt_alt) else: print('\t\033[2m' + opt_alt + '\033[22m') first = True