don't rely on setuptools for readline dependency check #361

Closed
wants to merge 2 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+39 −27
Diff settings

Always

Just for now

View
@@ -62,6 +62,7 @@
check_for_dependencies,
record_commit_info,
)
+from setupext import setupext
isfile = os.path.isfile
pjoin = os.path.join
@@ -219,10 +220,15 @@ def cleanup():
test='nose>=0.10.1',
)
requires = setup_args.setdefault('install_requires', [])
- if sys.platform == 'darwin':
- requires.append('readline')
- elif sys.platform.startswith('win'):
- requires.append('pyreadline')
+ setupext.display_status = False
+ if not setupext.check_for_readline():
+ if sys.platform == 'darwin':
+ requires.append('readline')
+ elif sys.platform.startswith('win'):
+ requires.append('pyreadline')
+ else:
+ pass
+ # do we want to install readline here?
# Script to be run by the windows binary installer after the default setup
# routine, to add shortcuts and similar windows-only things. Windows
View
@@ -18,29 +18,35 @@
display_status=True
-if display_status:
- def print_line(char='='):
- print char * 76
-
- def print_status(package, status):
- initial_indent = "%22s: " % package
- indent = ' ' * 24
- print fill(str(status), width=76,
- initial_indent=initial_indent,
- subsequent_indent=indent)
-
- def print_message(message):
- indent = ' ' * 24 + "* "
- print fill(str(message), width=76,
- initial_indent=indent,
- subsequent_indent=indent)
-
- def print_raw(section):
- print section
-else:
- def print_line(*args, **kwargs):
- pass
- print_status = print_message = print_raw = print_line
+def check_display(f):
+ """decorator to allow display methods to be muted by mod.display_status"""
+ def maybe_display(*args, **kwargs):
+ if display_status:
+ return f(*args, **kwargs)
+ return maybe_display
+
+@check_display
+def print_line(char='='):
+ print char * 76
+
+@check_display
+def print_status(package, status):
+ initial_indent = "%22s: " % package
+ indent = ' ' * 24
+ print fill(str(status), width=76,
+ initial_indent=initial_indent,
+ subsequent_indent=indent)
+
+@check_display
+def print_message(message):
+ indent = ' ' * 24 + "* "
+ print fill(str(message), width=76,
+ initial_indent=indent,
+ subsequent_indent=indent)
+
+@check_display
+def print_raw(section):
+ print section
#-------------------------------------------------------------------------------
# Tests for specific packages