Switch to checks for Mapping type and proper bool

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-05-04 15:53:56 -04:00
parent fcfebaf1cc
commit 08f61e7684
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -564,6 +564,10 @@ def multi_split(s, split):
def convert_deps_from_pip(dep):
""""Converts a pip-formatted dependency to a Pipfile-formatted one."""
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
dependency = {}
req = get_requirement(dep)
extras = {'extras': req.extras}
@@ -713,8 +717,8 @@ def convert_deps_to_pip(deps, project=None, r=True, include_index=False):
vcs = maybe_vcs[0] if maybe_vcs else None
if not any(key in deps[dep] for key in ['path', 'vcs', 'file']):
extra += extras
if not isinstance(deps[dep], six.string_types):
editable = str(deps[dep].get('editable', '')).lower() == 'true'
if not isinstance(deps[dep], Mapping):
editable = bool(deps[dep].get('editable', False))
# Support for files.
if 'file' in deps[dep]:
dep_file = deps[dep]['file']
+1 -1
View File
@@ -56,7 +56,7 @@ DEP_PIP_PAIRS = [
{'requests': {
'git': 'https://github.com/requests/requests.git',
'ref': 'master', 'extras': ['security'],
'editable': 'false'
'editable': False
}},
'git+https://github.com/requests/requests.git@master#egg=requests[security]',
),