[build-system]
-requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
+requires = [
+ "setuptools>=45",
+ "wheel",
+ "setuptools_scm>=6.2",
+]
+
+[tool.setuptools_scm]
+version_scheme = "python-simplified-semver"
\ No newline at end of file
[metadata]
name = teuthology
-version = attr: teuthology.__version__
long_description = file: README.rst
long_description_content_type = text/x-rst
url = https://github.com/ceph/teuthology
from __future__ import print_function
import os
+try:
+ import importlib.metadata as importlib_metadata
+except ImportError:
+ import importlib_metadata
+
+__version__ = importlib_metadata.version("teuthology")
# Tell gevent not to patch os.waitpid() since it is susceptible to race
# conditions. See:
monkey.patch_all()
import logging
-import subprocess
-
-__version__ = '1.1.0'
-
-# do our best, but if it fails, continue with above
-
-try:
- teuthology_dir = os.path.dirname(os.path.realpath(__file__))
- site_dir = os.path.dirname(teuthology_dir)
- git_dir = os.path.join(site_dir, '.git')
- # make sure we use git repo otherwise it is a released version
- if os.path.exists(git_dir):
- __version__ += '-' + str(subprocess.check_output(
- 'git rev-parse --short HEAD'.split(),
- cwd=site_dir
- ).decode()).strip()
-except Exception as e:
- # before logging; should be unusual
- print("Can't get version from git rev-parse %s" % e, file=sys.stderr)
# If we are running inside a virtualenv, ensure we have its 'bin' directory in
# our PATH. This doesn't happen automatically if scripts are called without