##// END OF EJS Templates
make display_status optional at runtime in setupext...
MinRK -
Show More
@@ -62,7 +62,7 b' from setupbase import ('
62 62 check_for_dependencies,
63 63 record_commit_info,
64 64 )
65 from setupext.setupext import check_for_readline
65 from setupext import setupext
66 66
67 67 isfile = os.path.isfile
68 68 pjoin = os.path.join
@@ -220,9 +220,10 b" if 'setuptools' in sys.modules:"
220 220 test='nose>=0.10.1',
221 221 )
222 222 requires = setup_args.setdefault('install_requires', [])
223 if not check_for_readline():
223 setupext.display_status = False
224 if not setupext.check_for_readline():
224 225 if sys.platform == 'darwin':
225 requires.append('readline')
226 requires.append('readline')
226 227 elif sys.platform.startswith('win'):
227 228 requires.append('pyreadline')
228 229 else:
@@ -18,29 +18,35 b' from textwrap import fill'
18 18
19 19 display_status=True
20 20
21 if display_status:
22 def print_line(char='='):
23 print char * 76
24
25 def print_status(package, status):
26 initial_indent = "%22s: " % package
27 indent = ' ' * 24
28 print fill(str(status), width=76,
29 initial_indent=initial_indent,
30 subsequent_indent=indent)
31
32 def print_message(message):
33 indent = ' ' * 24 + "* "
34 print fill(str(message), width=76,
35 initial_indent=indent,
36 subsequent_indent=indent)
37
38 def print_raw(section):
39 print section
40 else:
41 def print_line(*args, **kwargs):
42 pass
43 print_status = print_message = print_raw = print_line
21 def check_display(f):
22 """decorator to allow display methods to be muted by mod.display_status"""
23 def maybe_display(*args, **kwargs):
24 if display_status:
25 return f(*args, **kwargs)
26 return maybe_display
27
28 @check_display
29 def print_line(char='='):
30 print char * 76
31
32 @check_display
33 def print_status(package, status):
34 initial_indent = "%22s: " % package
35 indent = ' ' * 24
36 print fill(str(status), width=76,
37 initial_indent=initial_indent,
38 subsequent_indent=indent)
39
40 @check_display
41 def print_message(message):
42 indent = ' ' * 24 + "* "
43 print fill(str(message), width=76,
44 initial_indent=indent,
45 subsequent_indent=indent)
46
47 @check_display
48 def print_raw(section):
49 print section
44 50
45 51 #-------------------------------------------------------------------------------
46 52 # Tests for specific packages
General Comments 0
You need to be logged in to leave comments. Login now