Skip to content

Commit

Permalink
add support for returning setuptools version for bigquery statistics (#…
Browse files Browse the repository at this point in the history
…4209)

* add support for returning setuptools version for bigquery statistics

* don't send the data if None

* add changelog entry
  • Loading branch information
reaperhulk authored and xavfernandez committed Mar 22, 2017
1 parent 299da97 commit 476d297
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/4209.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add setuptools version to the statistics sent to BigQuery.
7 changes: 6 additions & 1 deletion pip/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
from pip.models import PyPI
from pip.utils import (splitext, rmtree, format_size, display_path,
backup_dir, ask_path_exists, unpack_file,
ARCHIVE_EXTENSIONS, consume, call_subprocess)
ARCHIVE_EXTENSIONS, consume, call_subprocess,
get_installed_version)
from pip.utils.encoding import auto_decode
from pip.utils.filesystem import check_path_owner
from pip.utils.logging import indent_log
Expand Down Expand Up @@ -119,6 +120,10 @@ def user_agent():
if HAS_TLS:
data["openssl_version"] = ssl.OPENSSL_VERSION

setuptools_version = get_installed_version("setuptools")
if setuptools_version is not None:
data["setuptools_version"] = setuptools_version

return "{data[installer][name]}/{data[installer][version]} {json}".format(
data=data,
json=json.dumps(data, separators=(",", ":"), sort_keys=True),
Expand Down

0 comments on commit 476d297

Please sign in to comment.