Rename python bindings package to google_benchmark. (#999)

A few people have complained that `benchmark` is too generic. Also, add
Python 3.8.
This commit is contained in:
Chris Jones 2020-07-09 09:23:06 +01:00 committed by GitHub
parent 7f27afe83b
commit 39c8d58a76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
load("//bindings/python:build_defs.bzl", "py_extension") load("//bindings/python:build_defs.bzl", "py_extension")
py_library( py_library(
name = "benchmark", name = "google_benchmark",
srcs = ["__init__.py"], srcs = ["__init__.py"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
@ -32,7 +32,7 @@ py_test(
srcs_version = "PY3", srcs_version = "PY3",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":benchmark", ":google_benchmark",
], ],
) )

View File

@ -13,14 +13,14 @@
# limitations under the License. # limitations under the License.
"""Example of Python using C++ benchmark framework. """Example of Python using C++ benchmark framework.
To run this example, you must first install the `benchmark` Python package. To run this example, you must first install the `google_benchmark` Python package.
To install using `setup.py`, download and extract the `benchmark` source. To install using `setup.py`, download and extract the `google_benchmark` source.
In the extracted directory, execute: In the extracted directory, execute:
python setup.py install python setup.py install
""" """
import benchmark import google_benchmark as benchmark
@benchmark.register @benchmark.register

View File

@ -17,7 +17,7 @@ IS_WINDOWS = sys.platform.startswith('win')
def _get_version(): def _get_version():
"""Parse the version string from __init__.py.""" """Parse the version string from __init__.py."""
with open(os.path.join(here, 'bindings', 'python', 'benchmark', '__init__.py')) as f: with open(os.path.join(here, 'bindings', 'python', 'google_benchmark', '__init__.py')) as f:
try: try:
version_line = next( version_line = next(
line for line in f if line.startswith('__version__')) line for line in f if line.startswith('__version__'))
@ -95,7 +95,7 @@ class BuildBazelExtension(build_ext.build_ext):
setuptools.setup( setuptools.setup(
name='google-benchmark', name='google_benchmark',
version=_get_version(), version=_get_version(),
url='https://github.com/google/benchmark', url='https://github.com/google/benchmark',
description='A library to benchmark code snippets.', description='A library to benchmark code snippets.',
@ -106,7 +106,7 @@ setuptools.setup(
packages=setuptools.find_packages('bindings/python'), packages=setuptools.find_packages('bindings/python'),
install_requires=_parse_requirements('bindings/python/requirements.txt'), install_requires=_parse_requirements('bindings/python/requirements.txt'),
cmdclass=dict(build_ext=BuildBazelExtension), cmdclass=dict(build_ext=BuildBazelExtension),
ext_modules=[BazelExtension('benchmark._benchmark', '//bindings/python/benchmark:_benchmark')], ext_modules=[BazelExtension('google_benchmark._benchmark', '//bindings/python/google_benchmark:_benchmark')],
zip_safe=False, zip_safe=False,
# PyPI package information. # PyPI package information.
classifiers=[ classifiers=[
@ -116,6 +116,7 @@ setuptools.setup(
'License :: OSI Approved :: Apache Software License', 'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Software Development :: Testing', 'Topic :: Software Development :: Testing',
'Topic :: System :: Benchmark', 'Topic :: System :: Benchmark',
], ],