Repository: ddelange/pipgrip

Issue:
Fails to discover dependencies of TensorFlow
<!-- To help debug your issue, please complete these sections: -->

#### What you were trying to do (and why)

I was trying to install a package that contains `tensorflow` as a dependency - this resulted in the error:
```
TypeError: 'NoneType' object is not iterable
```
The same behavior occurs when just resolving solo for TensorFlow `pipgrip -vvv tensorflow` 


#### What happened (including command output)

<!-- Include -vvv in your command -->

<details><summary>Command output</summary><p>

```console
$ pipgrip -vvv tensorflow

DEBUG: environment: {'implementation_name': 'cpython', 'implementation_version': '3.8.12', 'os_name': 'p
osix', 'platform_machine': 'x86_64', 'platform_release': '5.11.0-1023-gcp', 'platform_system': 'Linux', 
'platform_version': '#25~20.04.1-Ubuntu SMP Mon Nov 15 15:54:39 UTC 2021', 'python_full_version': '3.8.1
2', 'platform_python_implementation': 'CPython', 'python_version': '3.8', 'sys_platform': 'linux'}      
DEBUG: pip version: [21, 2, 4]                                                                          
DEBUG: pipgrip version: 0.6.10                                                                          
INFO: discovering tensorflow                                                                            
DEBUG: Downloading/building wheel for tensorflow into cache_dir /home/user/.cache/pip/wheels/pipgrip 
DEBUG: ['/home/user/miniconda3/envs/oocr-build-raw/bin/python', '-m', 'pip', 'wheel', '--no-deps', '-
-disable-pip-version-check', '--wheel-dir', '/home/user/.cache/pip/wheels/pipgrip', '--progress-bar=o
ff', 'tensorflow']                                                                                      
DEBUG: {'tensorflow': '/home/user/.cache/pip/wheels/pipgrip/tensorflow-2.7.0-cp38-cp38-manylinux2010_
x86_64.whl'}                                                                                            
DEBUG: Searching metadata in /home/user/.cache/pip/wheels/pipgrip/tensorflow-2.7.0-cp38-cp38-manylinu
x2010_x86_64.whl                                                                                        
DEBUG: Finding possible versions for tensorflow                                                         
DEBUG: ['/home/user/miniconda3/envs/oocr-build-raw/bin/python', '-m', 'pip', 'wheel', '--no-deps', '-
-disable-pip-version-check', '--progress-bar=off', 'tensorflow==42.42.post424242']                      
DEBUG: {'tensorflow': ['2.2.0', '2.2.1', '2.2.2', '2.2.3', '2.3.0', '2.3.1', '2.3.2', '2.3.3', '2.3.4', 
'2.4.0', '2.4.1', '2.4.2', '2.4.3', '2.4.4', '2.5.0', '2.5.1', '2.5.2', '2.6.0', '2.6.1', '2.6.2', '2.7.
0']}
INFO: fact: _root_ is root                                                                              
INFO: derived: root                                                                                     
INFO: fact: root depends on tensorflow (*)                                                              
INFO: selecting . (0.0.0)
INFO: derived: tensorflow (*)
INFO: discovering tensorflow==2.7.0
DEBUG: Downloading/building wheel for tensorflow==2.7.0 into cache_dir /home/user/.cache/pip/wheels/pipgrip
DEBUG: ['/home/user/miniconda3/envs/oocr-build-raw/bin/python', '-m', 'pip', 'wheel', '--no-deps', '--disable-pip-version-check', '--wheel-dir', '/home/user/.cache/pip/wheels/pipgrip', '--progress-bar=off', 'tensorflow==2.7.0']
DEBUG: {'tensorflow==2.7.0': '/home/user/.cache/pip/wheels/pipgrip/tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl'}
DEBUG: Searching metadata in /home/user/.cache/pip/wheels/pipgrip/tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl
Traceback (most recent call last):
  File "/home/user/miniconda3/envs/oocr-build-raw/bin/pipgrip", line 8, in <module>
    sys.exit(main())
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/pipgrip/cli.py", line 422, in main
    solution = solver.solve()
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/pipgrip/libs/mixology/version_solver.py", line 69, in solve
    if not self._run():
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/pipgrip/libs/mixology/version_solver.py", line 85, in _run
    next_package = self._choose_package_version()
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/pipgrip/libs/mixology/version_solver.py", line 363, in _choose_package_version
    for incompatibility in self._source.incompatibilities_for(
  File "/home/user/miniconda3/envs/oocr-build-raw/lib/python3.8/site-packages/pipgrip/libs/mixology/package_source.py", line 106, in incompatibilities_for
    for dependency in dependencies:
TypeError: 'NoneType' object is not iterable

```

</p></details>


#### What you expected to happen

I would expect to see packages required to install TensorFlow.


#### Step-by-step reproduction instructions

Minimal setup to reproduce this error is to simply run `pipgrip -vvv tensorflow`


Discussion:

Patch:
diff --git a/requirements/prod.txt b/requirements/prod.txt
index 068dfe3..6cd3a5b 100644
--- a/requirements/prod.txt
+++ b/requirements/prod.txt
@@ -1,7 +1,7 @@
 anytree
 click>=7
 packaging>=17
-pkginfo>=1.4.2
+pkginfo>=1.4.2,<1.8  # ref ddelange/pipgrip#68
 setuptools>=38.3  # for pkg_resources
 wheel
 pip>=7.1.0  # >=7.1.0 for --constraint


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 13f8df9..52c0838 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -13,7 +13,7 @@ def mock_download_wheel(package, *args, **kwargs):
     wheelhouse = {
         ".": self_wheel,
         "setuptools>=38.3": "./tests/assets/setuptools-44.0.0-py2.py3-none-any.whl",
-        "pkginfo>=1.4.2": "./tests/assets/pkginfo-1.5.0.1-py2.py3-none-any.whl",
+        "pkginfo<1.8,>=1.4.2": "./tests/assets/pkginfo-1.5.0.1-py2.py3-none-any.whl",
         "packaging>=17": "./tests/assets/packaging-20.0-py2.py3-none-any.whl",
         "click>=7": "./tests/assets/Click-7.0-py2.py3-none-any.whl",
         "click": "./tests/assets/Click-7.0-py2.py3-none-any.whl",