From 54af7a504c530407d2f4d707f6746f6729f51111 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 23 Feb 2018 15:33:08 -0800 Subject: [PATCH] Fixes #107 pip installing ptvsd fails on Python 2 --- setup.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/setup.py b/setup.py index 898b93c7..4cefaf3e 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ import os import os.path +import sys from setuptools import setup, Extension ROOT = os.path.dirname(os.path.abspath(__file__)) @@ -25,6 +26,18 @@ def get_pydevd_package_data(): for f in files: yield os.path.join(root[len(ptvsd_prefix) + 1:], f) +cmdclass = {} + +if sys.version_info[0] == 2: + from setuptools.command.build_ext import build_ext + class build_optional_ext(build_ext): + def build_extension(self, ext): + try: + super(build_optional_ext, self).build_extension(ext) + except: + pass + cmdclass = { 'build_ext': build_optional_ext } + setup(name='ptvsd', version='4.0.0a1', description='Visual Studio remote debugging server for Python', @@ -43,4 +56,5 @@ setup(name='ptvsd', ext_modules=[Extension('ptvsd.pydevd._pydevd_bundle.pydevd_cython', ['ptvsd/pydevd/_pydevd_bundle/pydevd_cython.c'], optional=True)], + cmdclass=cmdclass, )