Skip to content

Commit

Permalink
making setup compatible with older versions of pkg_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Apr 27, 2020
1 parent a762937 commit 8d8930e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import re
import setuptools
import subprocess
import sys
try:
import pkg_utils
except ImportError:
import subprocess
import sys
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "pkg_utils"])
import pkg_utils
result = subprocess.run(
[sys.executable, "-m", "pip", "show", "pkg_utils"],
check=True, capture_output=True)
match = re.search(r'\nVersion: (.*?)\n', result.stdout.decode(), re.DOTALL)
assert match and tuple(match.group(1).split('.')) >= ('0', '0', '5')
except (subprocess.CalledProcessError, AssertionError):
subprocess.run(
[sys.executable, "-m", "pip", "install", "-U", "pkg_utils"],
check=True)
import os
import pkg_utils

name = 'obj_tables'
dirname = os.path.dirname(__file__)
Expand Down

0 comments on commit 8d8930e

Please sign in to comment.