ivandasch commented on a change in pull request #17:
URL: 
https://github.com/apache/ignite-python-thin-client/pull/17#discussion_r577603149



##########
File path: setup.py
##########
@@ -13,92 +13,117 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from collections import defaultdict
+from distutils.command.build_ext import build_ext
+from distutils.errors import CCompilerError, DistutilsExecError, 
DistutilsPlatformError
+
 import setuptools
 import sys
 
 
-PYTHON_REQUIRED = (3, 4)
-PYTHON_INSTALLED = sys.version_info[:2]
+cext = setuptools.Extension(
+    "pyignite._cutils",
+    sources=[
+        "./cext/cutils.c"
+    ],
+    include_dirs=["./cext"]
+)
+
+if sys.platform == 'win32':
+    ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, 
IOError, ValueError)
+else:
+    ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
+
+
+class BuildFailed(Exception):
+    pass
+
+
+class ve_build_ext(build_ext):
+    # This class allows C extension building to fail.
 
-if PYTHON_INSTALLED < PYTHON_REQUIRED:
-    sys.stderr.write('''
+    def run(self):
+        try:
+            build_ext.run(self)
+        except DistutilsPlatformError:
+            raise BuildFailed()
 
-`pyignite` is not compatible with Python {}.{}!
-Use Python {}.{} or above.
+    def build_extension(self, ext):
+        try:
+            build_ext.build_extension(self, ext)
+        except ext_errors:
+            raise BuildFailed()
 
 
-'''.format(
-            PYTHON_INSTALLED[0],
-            PYTHON_INSTALLED[1],
-            PYTHON_REQUIRED[0],
-            PYTHON_REQUIRED[1],
+def run_setup(with_binary=True):
+    if with_binary:
+        kw = dict(
+            ext_modules=[cext],
+            cmdclass=dict(build_ext=ve_build_ext),
         )
+    else:
+        kw = dict()
+
+    setuptools.setup(
+        name='pyignite',
+        version='0.4.0',
+        python_requires='>=3.6',
+        author='The Apache Software Foundation',
+        author_email='d...@ignite.apache.org',
+        description='Apache Ignite binary client Python API',
+        url='https://github.com/apache/ignite-python-thin-client',
+        packages=setuptools.find_packages(),
+        install_requires=[
+            "attrs==18.1.0"
+        ],
+        tests_require=[
+            'pytest==3.6.1',
+            'pytest-cov==2.5.1',
+            'teamcity-messages==1.21',
+            'psutil==5.6.5',
+            'jinja2==2.11.3'
+        ],
+        setup_requires=[
+            'pytest-runner==4.2'
+        ],
+        extras_require={
+            'docs': [
+                'wheel==0.36.2',
+                'Sphinx==1.7.5',
+                'sphinxcontrib-fulltoc==1.2.0'
+            ],
+        },

Review comment:
       It's impossible, this is limitation of requirements.txt.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to