Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit 67433db

Browse files
authored
Call bindep as a module (#6)
1 parent 38af1da commit 67433db

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ repos:
3838
entry: mypy src/
3939
pass_filenames: false
4040
additional_dependencies:
41+
- bindep>=2.8.1
42+
- packaging
4143
- py>=1.9.0
4244
- repo: https://github.com/pre-commit/mirrors-pylint
4345
rev: v2.6.0
4446
hooks:
4547
- id: pylint
4648
additional_dependencies:
49+
- bindep>=2.8.1
50+
- packaging
4751
- pytest
4852
- pyyaml
4953
- tox

mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ no_implicit_optional = True
99
# 3rd party ignores, to remove once they add hints
1010
[mypy-tox.*]
1111
ignore_missing_imports = True
12+
13+
[mypy-bindep.*]
14+
ignore_missing_imports = True

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ setup_requires =
4949
install_requires =
5050
tox >= 3.18 # allowlist_externals
5151
bindep >= 2.8.1
52+
packaging
5253

5354
[options.entry_points]
5455
tox =

src/tox_bindep/hooks.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@
66
import subprocess
77
import sys
88

9+
from bindep import version as bindep_version
10+
from packaging.version import Version
11+
912
try:
1013
from tox import hookimpl
1114

1215
@hookimpl
1316
def tox_configure(config):
1417
"""..."""
1518
if os.path.isfile("bindep.txt"):
16-
cmd = ["bindep", "-b"]
19+
if Version(bindep_version) > Version("2.8.1"):
20+
module_name = "bindep"
21+
else:
22+
module_name = "bindep.main"
23+
cmd = [sys.executable, "-m", module_name, "-b"]
1724
# determine profiles
1825
result = subprocess.run(
19-
["bindep", "--profiles"],
26+
[sys.executable, "-m", module_name, "--profiles"],
2027
check=False,
2128
universal_newlines=True,
2229
stdout=subprocess.PIPE,

0 commit comments

Comments
 (0)