From 656ce5124931e1fd78e21aaaa35438215090454a Mon Sep 17 00:00:00 2001 From: Daniel Van Der Maden Date: Thu, 26 Dec 2019 19:54:56 -0800 Subject: [PATCH] [pyhmy] Add library import warnings and version --- pyhmy/__init__.py | 49 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/pyhmy/__init__.py b/pyhmy/__init__.py index 0354413..1903d43 100644 --- a/pyhmy/__init__.py +++ b/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