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