* 'pip.get_installed_distributions' doesn't include some packages such
as 'pip', 'setuptools' etc. so the installed versions for these is not
available. This change tries to guess the installed version by
importing the module and checking if the version is defined in
'__version__' variable.
* Another related change is that the 'required' and 'installed' versions
will be shown for all intermediate packages. When 'required' is not
specified, it will show 'None' and when 'installed' is not available,
it will show '?'. This is to keep the output consistent with the confusing deps
output.
* Fix indentation in output.
Kind of fixes#46.
This is done by:
* Forcing tox to install pip version >=8.0.2 inside the virtualenv
* Commenting out a failing assertion. The reason for this failure is
that the pkgs loaded from the pickled file lose a bit of information
w.r.t editable packages. This will be fixed properly in soon.
The primary reason behind refactoring the code is to be able to make it
straightforward to implement the --reverse mode (ie. instead of showing
package and their sub-deps, it will show the sub-deps and the packages
that need them).
As a part of this change, wrapper classes have been added for
Distribution and Requirements instances that pip returns. These wrapper
classes have handle the rendering of the pkg as a root (top level) and a
branch (non-top level) accordingly. As a result the same function
`render_tree` can be used for --reverse mode.
This change doesn't include the --reverse mode implementation. It will
be added in the subsequent commit.
This commit decouples the test virtualenv creation from tox and simplify
it for running both locally and on travis-ci. Creation of the test
virtualenvs now happen via Makefile target 'test-env' which will create
2 virtualenvs in the dir tests/virtualenvs and also dump their
respective package data in .pickle files that will be used by the tests.
Also, builds on travis now no longer depend on tox but reuses some of
the Makefile targets for test virtualenv creation/cleanup.
This makes the output of pipdeptree (with freeze flag) pip friendly
ie. the output can be saved in a requirements.txt file. At the same time
it's human readable due to indentations for sub-dependencies.
There is however one gotcha! In case pip finds a dependency multiple
times in the requirements.txt file, it fails. So the user will need to
take care about this when dumping the output in requirements.txt.
Fixes#31.
The pickle files for test virtualenv data were created using an older
version of pip. As tox started using the newer version of pip, these
files were obsolete and it lead to failure of tests run via tox. This is
now fixed by regenerating the pickle files for pip ver. 6.0.8
c70525bb84 broke Python 2.6 compatibility
by using a dict comprehension, which is a Python 2.7 feature. I replaced
it with calling dict with a generator expression, which looks almost as
good and it works in Python 2.6.
https://github.com/pypa/pip/issues/1867
When hash randomization is enabled, pip can return different names for
git editables from run to run.
This change accounts for that in the tests for freezed output.
* Added code to show warnings about possibly confusing dependencies
* A command line option '-w' or '--nowarn' added to allow for inhibition
of the warnings
* A lot of code had to be refactored to do this cleanly