Skip to content

Commit

Permalink
compare golang versions using packaging.version
Browse files Browse the repository at this point in the history
  • Loading branch information
dvmazur authored and Maxim Kashirin committed May 14, 2021
1 parent 67b2d44 commit e6c9277
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import tarfile
import tempfile

from packaging import version
from pkg_resources import parse_requirements
from setuptools import setup, find_packages
from setuptools.command.develop import develop
Expand Down Expand Up @@ -52,10 +53,10 @@ def install_libp2p_daemon():
stdout=subprocess.PIPE)
result, _ = proc.communicate()
result = result.decode('ascii', 'replace')
_, _, version, _ = result.split(' ')
version = version.lstrip('go')
_, _, v, _ = result.split(' ')
v = v.lstrip('go')

if version < "1.13":
if version.parse(v) < version.parse("1.13"):
raise EnvironmentError(f'newer version of go required: must be >= 1.13, found {version}')

except FileNotFoundError:
Expand Down

0 comments on commit e6c9277

Please sign in to comment.