Skip to content

Commit

Permalink
fix: better handling of case sensetivity
Browse files Browse the repository at this point in the history
some packags like Django-Select2 install as lowercase, and the code
didn't expect that
  • Loading branch information
michael-go committed Jan 11, 2018
1 parent 727fca9 commit 70f10ce
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
5 changes: 4 additions & 1 deletion plug/pip_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ def create_tree_of_packages_dependencies(dist_tree, packages_names, req_file_pat
key_tree = dict((k.key, v) for k, v in tree.items())

def get_children(n): return key_tree.get(n.key, [])
lowercase_pkgs_names = [p.lower() for p in packages_names]
packages_as_dist_obj = [
p for p in nodes if p.key in packages_names or p.project_name in packages_names]
p for p in nodes if
p.key.lower() in lowercase_pkgs_names or
(p.project_name and p.project_name.lower()) in lowercase_pkgs_names]

def create_children_recursive(root_package, key_tree):
root_name = root_package[NAME].lower()
Expand Down
28 changes: 28 additions & 0 deletions test/inspect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ test('inspect', function (t) {
},
}, 'python-etcd is ok');

t.match(pkg.dependencies['django-select2'], {
name: 'django-select2',
version: '6.0.1',
from: [
'pip-app@0.0.0',
'django-select2@6.0.1',
],
dependencies: {
'django-appconf': {
name: 'django-appconf',
},
},
}, 'django-select2 looks ok');

t.end();
});

Expand Down Expand Up @@ -199,6 +213,20 @@ test('transitive dep not installed, but with allowMissing option', function (t)
},
}, 'python-etcd is ok');

t.match(pkg.dependencies['django-select2'], {
name: 'django-select2',
version: '6.0.1',
from: [
'pip-app@0.0.0',
'django-select2@6.0.1',
],
dependencies: {
'django-appconf': {
name: 'django-appconf',
},
},
}, 'django-select2 looks ok');

t.end();
});

Expand Down
2 changes: 1 addition & 1 deletion test/workspaces/pip-app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Jinja2==2.7.2
Django==1.6.1
python-etcd==0.4.5

Django-Select2==6.0.1 # this version installs with lowercase so it catches a previous bug in pip_resolve.py

0 comments on commit 70f10ce

Please sign in to comment.