[pyhmy] Add library import warnings and version

pull/2/head
Daniel Van Der Maden 5 years ago
parent a001cdc7f5
commit 656ce51249
  1. 49
      pyhmy/__init__.py

@ -1,14 +1,35 @@
#
# This package relies on the fact that there is a CLI binary from some path
# starting at the root of the file script importing this package.
# This package requires the pexpect package: https://pypi.org/project/pexpect/ .
#
from pyhmy.cli import HmyCLI, get_environment
import os
# Find the CLI binary for HmyCLI.
for root, dirs, files in os.walk(os.path.curdir):
if "hmy" in files:
HmyCLI.hmy_binary_path = os.path.join(root, "hmy")
break
import sys
import warnings
import pkg_resources
from .cli import (
HmyCLI,
get_environment,
)
from .util import (
Typgpy,
get_gopath,
get_goversion,
json_load
)
if sys.version_info.major < 3:
warnings.simplefilter("always", DeprecationWarning)
warnings.warn(
DeprecationWarning(
"`pyhmy` does not support Python 2. Please use Python 3."
)
)
warnings.resetwarnings()
if sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
warnings.simplefilter("always", ImportWarning)
warnings.warn(
ImportWarning(
"`pyhmy` does not work on Windows or Cygwin."
)
)
warnings.resetwarnings()
__version__ = pkg_resources.get_distribution("pyhmy").version

Loading…
Cancel
Save