Permalink
Browse files

Merge pull request #69 from FZambia/redhat_setup

attempt to fix installation problems on CentOS 5
  • Loading branch information...
2 parents d6cdaa9 + 83eca0e commit 94d6211b1b48bfbac320d7fd7d7f0a1f531095c5 @fiorix committed Sep 26, 2012
Showing with 21 additions and 3 deletions.
  1. +21 −3 setup.py
View
@@ -16,11 +16,29 @@
# under the License.
import sys
-
-requires = ["twisted", "pyopenssl"]
-
+import platform
from distutils import log
from distutils.core import setup
+from distutils.version import StrictVersion
+
+
+requires = ["twisted"]
+
+
+pyopenssl = "pyopenssl"
+# avoiding installation problems on old RedHat distributions (ex. CentOS 5)
+# http://stackoverflow.com/questions/7340784/easy-install-pyopenssl-error
+py_version = platform.python_version()
+if StrictVersion(py_version) < StrictVersion('2.6'):
+ distname, version, _id = platform.dist()
+else:
+ distname, version, _id = platform.linux_distribution()
+is_redhat = distname in ["CentOS", "redhat"]
+if is_redhat and version and StrictVersion(version) < StrictVersion('6.0'):
+ pyopenssl = "pyopenssl==0.12"
+
+requires.append(pyopenssl)
+
# PyPy and setuptools don't get along too well, yet.
if sys.subversion[0].lower().startswith('pypy'):

0 comments on commit 94d6211

Please sign in to comment.