Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

use bundled argparse if system argparse is < 1.1 #726

Merged
merged 1 commit into from

2 participants

@minrk
Owner

argparse 1.0.1 has issues and is super old, but might be installed on some systems. external.argparse should use the bundled version if system argparse is older than 1.1.

@fperez
Owner

+1, safe thing to do esp. given how weird the error message is. Merge away.

@minrk minrk merged commit 0d3b074 into ipython:master
@ellisonbg ellisonbg referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 23, 2011
  1. @minrk
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 9 deletions.
  1. +7 −9 IPython/external/argparse/__init__.py
View
16 IPython/external/argparse/__init__.py
@@ -1,13 +1,11 @@
try:
import argparse
- # Workaround an argparse bug, FIXED in argparse 1.1.0
- if 'RawTextHelpFormatterArgumentDefaultsHelpFormatter' in argparse.__all__:
- import itertools
- argparse.__all__ = list(itertools.chain( [i for i in argparse.__all__
- if i != 'RawTextHelpFormatterArgumentDefaultsHelpFormatter'],
- ['RawTextHelpFormatter', 'ArgumentDefaultsHelpFormatter']))
- argparse.__all__.append('SUPPRESS')
- from argparse import *
-except ImportError:
+ # don't use system argparse if older than 1.1:
+ if argparse.__version__ < '1.1':
+ raise ImportError
+ else:
+ from argparse import *
+ from argparse import SUPPRESS
+except (ImportError, AttributeError):
from _argparse import *
from _argparse import SUPPRESS
Something went wrong with that request. Please try again.