Show number of dependent packages

* With flag "-show" and a list of package names,
  call crates.io api to count dependent packages.
  * The packages are NOT fetched.
  * Optional dependent packages are not counted.
  * Indirect non-dev dependent packages are counted.
  * Finally all non-dev dependent packages are also
    included in the report.
  * The report is a table like this:

  build_deps[k] = # of non-dev-dependent packages of pkg[k]
  dev_deps[k] = # of all dependent packages of pkg[k]
  all_build_deps[k] = # of non-dev-dependent ... of pkg[1] to pkg[k]
  all_dev_deps[k] = # of all dependent ... of pkg[1] to pkg[k]
    k pkg         build_deps   dev_deps all_build_deps   all_dev_deps
    1 unicode-xid          0          0              0              0
    2 proc-macro2          1          3              0              1
    3 syn                  2        107              0            104
    4 quote                2         18              0            107
    5 remain               4         18              0            107

  Packages are sorted topologically by the non-dev-dependencies.
  The column all_build_deps should be 0 if the topological sort
  did not find cyclic dependency.

* Simplify find_dl_path with a crates.io api call to get max_version.
* Handle urllib.error.HTTPError exception
* Formatted by pyformat.

Test: get_rust_pkg.py -h
Test: get_rust_pkg.py -show syn remain quote
Test: get_rust_pkg.py -v -show remain syn quote

Change-Id: Ib4ece8dd391558fb5fd866b153f30cd2ef59f6b3
1 file changed