add support for returning setuptools version for bigquery statistics (#4209)

* add support for returning setuptools version for bigquery statistics

* don't send the data if None

* add changelog entry
This commit is contained in:
Paul Kehrer 2017-03-22 18:59:43 -04:00 committed by Xavier Fernandez
parent 299da9762c
commit 476d297ff6
2 changed files with 7 additions and 1 deletions

1
news/4209.feature Normal file
View File

@ -0,0 +1 @@
Add setuptools version to the statistics sent to BigQuery.

View File

@ -28,7 +28,8 @@ from pip.exceptions import InstallationError, HashMismatch
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
@ -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),