Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
wants to merge 2 commits into from

3 participants

@minrk
Owner

ddale reported (#343 (comment)) an issue with the readline dependency.

I imagine this is because setuptools does not actually know about packages that it did not install, so readline installed by other means (my guess from his path is that he uses macports) will not show up.

This commit does explicit import checks, rather than trusting setuptools to find the dependency.

setup.py
@@ -219,10 +220,14 @@ if 'setuptools' in sys.modules:
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')
+ if not check_for_readline():
+ if sys.platform == 'darwin':
+ requires.append('readline')
@ddale
ddale added a note

extra indentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ddale

That works, although it also yields "readline: yes" printed in the terminal.

@minrk minrk make display_status optional at runtime in setupext
This allow the check_for_readline to *not* print its indented status line
21d05ca
@minrk
Owner

fixed the extra line by making the check_for_x functions printing optional

@fperez
Owner

great, go ahead and merge then. Thanks to @ddale for the checks and review!

@minrk minrk closed this pull request from a commit
@minrk minrk make display_status optional at runtime in setupext
This allow the check_for_readline to *not* print its indented status line

closes gh-361
closes gh-20
901196b
@minrk minrk closed this in 901196b
@ellisonbg ellisonbg referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this pull request from a commit in mattvonrocketstein/ipython
@minrk minrk make display_status optional at runtime in setupext
This allow the check_for_readline to *not* print its indented status line

closes gh-361
closes gh-20
6527b74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 11, 2011
  1. @minrk
  2. @minrk

    make display_status optional at runtime in setupext

    minrk authored
    This allow the check_for_readline to *not* print its indented status line
This page is out of date. Refresh to see the latest.
Showing with 39 additions and 27 deletions.
  1. +10 −4 setup.py
  2. +29 −23 setupext/setupext.py
View
14 setup.py
@@ -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
52 setupext/setupext.py
@@ -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
Something went wrong with that request. Please try again.