Support Python 3.7 in build scripts and generate Cython extensions for it (PY-27651)

This commit is contained in:
Elizaveta Shashkova
2018-03-19 14:41:20 +03:00
parent dca8627cc8
commit b7c446213b
35 changed files with 5845 additions and 1436 deletions
@@ -32,6 +32,9 @@ envs {
python "python36_64", "3.6.3", "64"
virtualenv "py36_64", "python36_64", ["cython"]
python "python37_64", "3.7.0b2", "64"
virtualenv "py37_64", "python37_64", ["cython"]
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
python "python26_32", "2.6.6", "32"
virtualenv "py26_32", "python26_32", ["cython"]
@@ -47,6 +50,9 @@ envs {
python "python36_32", "3.6.3", "32"
virtualenv "py36_32", "python36_32", ["cython"]
python "python37_32", "3.7.0b2", "32"
virtualenv "py37_32", "python37_32", ["cython"]
}
}
@@ -7,7 +7,7 @@ from _pydev_bundle import pydev_log
from _pydevd_bundle.pydevd_frame import PyDBFrame
# ENDIF
version = 10
version = 11
if not hasattr(sys, '_current_frames'):
@@ -78,10 +78,8 @@ try:
if sys.version_info[0] >= 3:
IS_PY3K = True
IS_PY2 = False
if (sys.version_info[0] == 3 and sys.version_info[1] >= 4) or sys.version_info[0] > 3:
IS_PY34_OR_GREATER = True
if (sys.version_info[0] == 3 and sys.version_info[1] >= 6) or sys.version_info[0] > 3:
IS_PY36_OR_GREATER = True
IS_PY34_OR_GREATER = sys.version_info >= (3, 4)
IS_PY36_OR_GREATER = sys.version_info >= (3, 6)
elif sys.version_info[0] == 2 and sys.version_info[1] == 7:
IS_PY27 = True
elif sys.version_info[0] == 2 and sys.version_info[1] == 4:
File diff suppressed because it is too large Load Diff
@@ -11,7 +11,7 @@ pydev_log.debug("Using Cython speedups")
# from _pydevd_bundle.pydevd_frame import PyDBFrame
# ENDIF
version = 10
version = 11
if not hasattr(sys, '_current_frames'):
@@ -3,9 +3,7 @@ import sys
from _pydevd_bundle.pydevd_constants import IS_PYCHARM
IS_PY36 = False
if sys.version_info[0] == 3 and sys.version_info[1] == 6:
IS_PY36 = True
IS_PY36_OR_GREATER = sys.version_info >= (3, 6)
frame_eval_func = None
stop_frame_eval = None
@@ -19,7 +17,7 @@ if USE_FRAME_EVAL == 'NO':
frame_eval_func, stop_frame_eval = None, None
else:
if IS_PY36:
if IS_PY36_OR_GREATER:
try:
from _pydevd_frame_eval.pydevd_frame_eval_cython_wrapper import frame_eval_func, stop_frame_eval, enable_cache_frames_without_breaks, \
dummy_trace_dispatch
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -104,13 +104,13 @@ def build():
env = os.environ.copy()
if sys.version_info[:2] in ((2,6), (2,7), (3,5), (3, 6)):
if sys.version_info[:2] in ((2, 6), (2, 7), (3, 5), (3, 6), (3, 7)):
import setuptools # We have to import it first for the compiler to be found
from distutils import msvc9compiler
if sys.version_info[:2] in ((2,6), (2,7)):
if sys.version_info[:2] in ((2, 6), (2, 7)):
vcvarsall = msvc9compiler.find_vcvarsall(9.0)
elif sys.version_info[:2] in ((3,5), (3,6)):
elif sys.version_info[:2] in ((3, 5), (3, 6), (3, 7)):
vcvarsall = msvc9compiler.find_vcvarsall(14.0)
if vcvarsall is None or not os.path.exists(vcvarsall):
raise RuntimeError('Error finding vcvarsall.')
@@ -156,6 +156,7 @@ def build():
print('Calling args: %s' % (args,))
subprocess.check_call(args, env=env,)
if __name__ == '__main__':
use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
if use_cython == 'YES':
@@ -12,6 +12,7 @@ python_installations = [
r'%s/py34_64/bin/python' % miniconda64_envs,
r'%s/py35_64/bin/python' % miniconda64_envs,
r'%s/py36_64/bin/python' % miniconda64_envs,
r'%s/py37_64/bin/python' % miniconda64_envs,
]
root_dir = os.path.dirname(os.path.dirname(__file__))
@@ -49,7 +50,8 @@ def main():
python_install, os.path.join(root_dir, 'build_tools', 'build.py'), '--no-remove-binaries', '--target-pyd-name=%s' % new_name, '--force-cython']
if i != 0:
args.append('--no-regenerate-files')
if extract_version(python_install).startswith('36'):
version_number = extract_version(python_install)
if version_number.startswith('36') or version_number.startswith('37'):
name_frame_eval = 'pydevd_frame_evaluator_%s_%s' % (sys.platform, extract_version(python_install))
args.append('--target-pyd-frame-eval=%s' % name_frame_eval)
print('Calling: %s' % (' '.join(args)))
@@ -77,20 +77,25 @@ python_installations = [
r'%s\py34_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py35_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py36_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py37_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py26_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py27_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py34_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py35_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py36_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py37_64\Scripts\python.exe' % miniconda64_envs,
]
root_dir = os.path.dirname(os.path.dirname(__file__))
def list_binaries():
for f in os.listdir(os.path.join(root_dir, '_pydevd_bundle')):
if f.endswith('.pyd'):
yield f
def extract_version(python_install):
return python_install.split('\\')[-3][2:]
@@ -118,14 +123,14 @@ def main():
python_install, os.path.join(root_dir, 'build_tools', 'build.py'), '--no-remove-binaries', '--target-pyd-name=%s' % new_name, '--force-cython']
if i != 0:
args.append('--no-regenerate-files')
if extract_version(python_install).startswith('36'):
version_number = extract_version(python_install)
if version_number.startswith('36') or version_number.startswith('37'):
name_frame_eval = 'pydevd_frame_evaluator_%s_%s' % (sys.platform, extract_version(python_install))
args.append('--target-pyd-frame-eval=%s' % name_frame_eval)
print('Calling: %s' % (' '.join(args)))
subprocess.check_call(args)
if __name__ == '__main__':
main()
+3 -1
View File
@@ -15,6 +15,8 @@ from setuptools import setup
os.chdir(os.path.dirname(os.path.abspath(__file__)))
IS_PY36_OR_GREATER = sys.version_info > (3, 6)
def process_args():
extension_folder = None
@@ -105,7 +107,7 @@ if target_pydevd_name is None:
target_pydevd_name = extension_name
build_extension("_pydevd_bundle", extension_name, target_pydevd_name, force_cython, extension_folder)
if sys.version_info[:2] == (3, 6):
if IS_PY36_OR_GREATER:
extension_name = "pydevd_frame_evaluator"
if target_frame_eval is None:
target_frame_eval = extension_name