You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/10/09 08:50:52 UTC
[06/10] libcloud git commit: warning when backports not available as
will attempted to be imported on module-level import,
in setuptools this causes an issue as it's before the pip job runs
warning when backports not available as will attempted to be imported on module-level import, in setuptools this causes an issue as it's before the pip job runs
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2888c720
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2888c720
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2888c720
Branch: refs/heads/trunk
Commit: 2888c720e4b130dadbc2d566b8083bf172524845
Parents: 5d7c437
Author: Anthony Shaw <an...@apache.org>
Authored: Fri Jun 24 16:52:13 2016 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Jun 24 16:52:13 2016 +1000
----------------------------------------------------------------------
libcloud/utils/py3.py | 6 +++++-
setup.py | 9 ---------
2 files changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2888c720/libcloud/utils/py3.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py
index 742d409..ef38eed 100644
--- a/libcloud/utils/py3.py
+++ b/libcloud/utils/py3.py
@@ -64,7 +64,11 @@ if sys.version_info >= (3, 2) and sys.version_info < (3, 3):
PY32 = True
if PY2_pre_279 or PY3_pre_32:
- from backports.ssl_match_hostname import match_hostname, CertificateError # NOQA
+ try:
+ from backports.ssl_match_hostname import match_hostname, CertificateError # NOQA
+ except ImportError:
+ import warnings
+ warnings.warn("Missing backports.ssl_match_hostname package")
else:
# ssl module in Python >= 3.2 includes match hostname function
from ssl import match_hostname, CertificateError # NOQA
http://git-wip-us.apache.org/repos/asf/libcloud/blob/2888c720/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 2de4048..8a3df01 100644
--- a/setup.py
+++ b/setup.py
@@ -28,15 +28,6 @@ try:
except ImportError:
has_epydoc = False
-# Mock out the backports module incase an import is requested.
-class MockBackports:
- def match_hostname():
- pass
-
- def CertificateError():
- pass
-
-sys.modules['backports.ssl_match_hostname'] = MockBackports
import libcloud.utils # NOQA
from libcloud.utils.dist import get_packages, get_data_files # NOQA