You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2016/10/14 19:44:20 UTC

[2/3] incubator-beam git commit: Added cython version check

Added cython version check

Replaced assertions with warnings.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/36ea9b4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/36ea9b4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/36ea9b4f

Branch: refs/heads/python-sdk
Commit: 36ea9b4f974a106ac19953ee01d2cdcf8ad53b40
Parents: 2b5061a
Author: markon <ma...@gmail.com>
Authored: Thu Sep 29 20:45:18 2016 +0200
Committer: Robert Bradshaw <ro...@gmail.com>
Committed: Fri Oct 14 12:41:13 2016 -0700

----------------------------------------------------------------------
 sdks/python/setup.py | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/36ea9b4f/sdks/python/setup.py
----------------------------------------------------------------------
diff --git a/sdks/python/setup.py b/sdks/python/setup.py
index 20870b8..b2d22ff 100644
--- a/sdks/python/setup.py
+++ b/sdks/python/setup.py
@@ -21,8 +21,11 @@ from distutils.version import StrictVersion
 
 import os
 import platform
+import warnings
+
 import setuptools
-import pkg_resources
+
+from pkg_resources import get_distribution, DistributionNotFound
 
 
 def get_version():
@@ -43,9 +46,30 @@ PACKAGE_LONG_DESCRIPTION = '''
 TBD
 '''
 
-_PIP_VERSION = pkg_resources.get_distribution('pip').version
-assert StrictVersion(_PIP_VERSION) >= StrictVersion('0.7.0'), \
-    "This SDK requires 'pip' >= 7.0.0"
+REQUIRED_PIP_VERSION = '7.0.0'
+_PIP_VERSION = get_distribution('pip').version
+if StrictVersion(_PIP_VERSION) < StrictVersion(REQUIRED_PIP_VERSION):
+  warnings.warn(
+      "You are using version {0} of pip. " \
+      "However, version {1} is recommended.".format(
+          _PIP_VERSION, REQUIRED_PIP_VERSION
+      )
+  )
+
+
+REQUIRED_CYTHON_VERSION = '0.23.2'
+try:
+  _CYTHON_VERSION = get_distribution('cython').version
+  if StrictVersion(_CYTHON_VERSION) < StrictVersion(REQUIRED_CYTHON_VERSION):
+    warnings.warn(
+        "You are using version {0} of cython. " \
+        "However, version {1} is recommended.".format(
+            _CYTHON_VERSION, REQUIRED_CYTHON_VERSION
+        )
+    )
+except DistributionNotFound:
+  # do nothing if Cython is not installed
+  pass
 
 # Currently all compiled modules are optional  (for performance only).
 if platform.system() == 'Windows':
@@ -71,6 +95,7 @@ REQUIRED_PACKAGES = [
     'pyyaml>=3.10',
     ]
 
+
 setuptools.setup(
     name=PACKAGE_NAME,
     version=PACKAGE_VERSION,