Skip to content

Commit

Permalink
Call bindep as a module (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jan 29, 2021
1 parent 38af1da commit 67433db
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Expand Up @@ -38,12 +38,16 @@ repos:
entry: mypy src/
pass_filenames: false
additional_dependencies:
- bindep>=2.8.1
- packaging
- py>=1.9.0
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.6.0
hooks:
- id: pylint
additional_dependencies:
- bindep>=2.8.1
- packaging
- pytest
- pyyaml
- tox
3 changes: 3 additions & 0 deletions mypy.ini
Expand Up @@ -9,3 +9,6 @@ no_implicit_optional = True
# 3rd party ignores, to remove once they add hints
[mypy-tox.*]
ignore_missing_imports = True

[mypy-bindep.*]
ignore_missing_imports = True
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -49,6 +49,7 @@ setup_requires =
install_requires =
tox >= 3.18 # allowlist_externals
bindep >= 2.8.1
packaging

[options.entry_points]
tox =
Expand Down
11 changes: 9 additions & 2 deletions src/tox_bindep/hooks.py
Expand Up @@ -6,17 +6,24 @@
import subprocess
import sys

from bindep import version as bindep_version
from packaging.version import Version

try:
from tox import hookimpl

@hookimpl
def tox_configure(config):
"""..."""
if os.path.isfile("bindep.txt"):
cmd = ["bindep", "-b"]
if Version(bindep_version) > Version("2.8.1"):
module_name = "bindep"
else:
module_name = "bindep.main"
cmd = [sys.executable, "-m", module_name, "-b"]
# determine profiles
result = subprocess.run(
["bindep", "--profiles"],
[sys.executable, "-m", module_name, "--profiles"],
check=False,
universal_newlines=True,
stdout=subprocess.PIPE,
Expand Down

0 comments on commit 67433db

Please sign in to comment.