Skip to content

Commit

Permalink
Use setuptools_scm for version handling.
Browse files Browse the repository at this point in the history
This includes manual configuration to avoid
pypa/setuptools-scm#411.

Also `import setuptools_scm` directly in `setup.py` to make sure that
`0.0.0` is not used as version, see pypa/setuptools-scm#386.
  • Loading branch information
Flameeyes committed Mar 25, 2020
1 parent 9046243 commit 6eb3665
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
[build-system]
requires = [
'setuptools >= 42',
'wheel',
'setuptools_scm[toml]>=3.4',
]

[tool.black]
line-ngth = 80
target-version = ['py37']

[tool.isort]
line_length = 80
known_third_party = ['absl', 'construct', 'hexdump', 'pcapng']

[tool.setuptools_scm]
# Until a new version of setuptools_scm with a fix for the following issue is
# released, override the default configuration here.
# https://github.com/pypa/setuptools_scm/issues/411
tag_regex = '^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$'
git_describe_command = 'git describe --dirty --tags --long --match *[0-9]*'
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand

import setuptools_scm # Ensure it's present.

test_required = [
"absl-py",
"construct>=2.9",
Expand All @@ -41,7 +43,6 @@

setup(
name="usbmon-tools",
version="1",
description="usbmon processing utilities (for Linux and Windows captures).",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -62,5 +63,5 @@
package_data={package: ["py.typed"] for package in all_packages},
install_requires=["construct>=2.9", "hexdump", "python-pcapng>=1.0",],
tests_require=test_required,
extras_require={"dev": test_required + ["pre-commit"],},
extras_require={"dev": test_required + ["pre-commit", "setuptools_scm"],},
)

0 comments on commit 6eb3665

Please sign in to comment.