From 3737932ac42d562f0bc28796e75227985fa927d9 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sun, 5 Nov 2017 21:17:23 -0600 Subject: [PATCH 1/5] Add USE_GMP option to use with external ISL built with imath --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6cc8bb3..48fc149 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ def get_config_schema(): return ConfigSchema([ Switch("USE_SHIPPED_ISL", True, "Use included copy of isl"), Switch("USE_SHIPPED_IMATH", True, "Use included copy of imath in isl"), + Switch("USE_GMP", True, "Use gmp in external isl"), Switch("USE_BARVINOK", False, "Include wrapper for Barvinok"), Switch("USE_IMATH_SIO", False, "When using imath, use small-integer " "optimization"), @@ -236,7 +237,8 @@ def main(): INCLUDE_DIRS.extend(conf["ISL_INC_DIR"]) - if not (conf["USE_SHIPPED_ISL"] and conf["USE_SHIPPED_IMATH"]): + if not (conf["USE_SHIPPED_ISL"] and conf["USE_SHIPPED_IMATH"]) and \ + conf["USE_GMP"]: INCLUDE_DIRS.extend(conf["GMP_INC_DIR"]) LIBRARY_DIRS.extend(conf["GMP_LIB_DIR"]) LIBRARIES.extend(conf["GMP_LIBNAME"]) -- GitLab From 522ecb641c23423ed3b9bf09b3efb5391ed450ec Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sun, 5 Nov 2017 21:17:37 -0600 Subject: [PATCH 2/5] Fix gen_wrap.py for windows --- gen_wrap.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/gen_wrap.py b/gen_wrap.py index cbbe940..d42ab83 100644 --- a/gen_wrap.py +++ b/gen_wrap.py @@ -360,18 +360,32 @@ import threading _PY3 = sys.version_info >= (3,) +is_win = sys.platform.startswith('win32') from islpy._isl_cffi import ffi -lib = ffi.dlopen(None) + +if is_win: + lib = ffi.dlopen('_isl_cffi.pyd') +else: + lib = ffi.dlopen(None) from cffi import FFI libc_ffi = FFI() -libc_ffi.cdef(''' + +cdef_string = ''' char *strdup(const char *s); void free(void *ptr); - ''') + ''' -libc = libc_ffi.dlopen(None) +if is_win: + cdef_string = cdef_string.replace('strdup', '_strdup') + +libc_ffi.cdef(cdef_string) + +if is_win: + libc = libc_ffi.dlopen('msvcrt') +else: + libc = libc_ffi.dlopen(None) class Error(Exception): @@ -465,7 +479,10 @@ class _EnumBase(object): class _ManagedCString(object): def __init__(self, cdata): - self.data = libc.strdup(cdata) + if is_win: + self.data = libc._strdup(cdata) + else: + self.data = libc.strdup(cdata) if self.data == libc_ffi.NULL: raise Error("strdup() failed") -- GitLab From af7dfc0d775279226cbfb43ba2136d77c83c2919 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 24 Aug 2018 03:11:00 -0500 Subject: [PATCH 3/5] Fix gen_wrap to use soabi in win --- gen_wrap.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gen_wrap.py b/gen_wrap.py index d42ab83..e8afe3f 100644 --- a/gen_wrap.py +++ b/gen_wrap.py @@ -25,6 +25,7 @@ THE SOFTWARE. import re import sys from py_codegen import PythonCodeGenerator, Indentation +from distutils.sysconfig import get_config_var SEM_TAKE = "take" SEM_GIVE = "give" @@ -365,7 +366,7 @@ is_win = sys.platform.startswith('win32') from islpy._isl_cffi import ffi if is_win: - lib = ffi.dlopen('_isl_cffi.pyd') + lib = ffi.dlopen('{win_pyd}') else: lib = ffi.dlopen(None) @@ -395,7 +396,7 @@ class Error(Exception): class IslTypeError(Error, TypeError): pass -_context_use_map = {} +_context_use_map = {{}} def _deref_ctx(ctx_data, ctx_iptr): _context_use_map[ctx_iptr] -= 1 @@ -1641,7 +1642,12 @@ def gen_wrapper(include_dirs, include_barvinok=False, isl_version=None): wrapper_f.write( "# AUTOMATICALLY GENERATED by gen_wrap.py -- do not edit\n") - wrapper_f.write(PY_PREAMBLE) + win_soabi = get_config_var('SOABI') + if win_soabi is not None: + win_pyd = "_isl_cffi.{}.pyd".format(win_soabi) + else: + win_pyd = "_isl_cffi.pyd" + wrapper_f.write(PY_PREAMBLE.format(win_pyd=win_pyd)) write_enums_to_wrapper(wrapper_f) write_classes_to_wrapper(wrapper_f) -- GitLab From f6db3dcd25233d89f865b7755df7a0148622a124 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 24 Aug 2018 04:01:04 -0500 Subject: [PATCH 4/5] Link to ucrtbase instead of msvcrt.dll --- gen_wrap.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gen_wrap.py b/gen_wrap.py index e8afe3f..018fc82 100644 --- a/gen_wrap.py +++ b/gen_wrap.py @@ -383,8 +383,8 @@ if is_win: libc_ffi.cdef(cdef_string) -if is_win: - libc = libc_ffi.dlopen('msvcrt') +if is_win and sys.version_info >= (3,5): + libc = libc_ffi.dlopen('ucrtbase') else: libc = libc_ffi.dlopen(None) @@ -1642,11 +1642,10 @@ def gen_wrapper(include_dirs, include_barvinok=False, isl_version=None): wrapper_f.write( "# AUTOMATICALLY GENERATED by gen_wrap.py -- do not edit\n") - win_soabi = get_config_var('SOABI') - if win_soabi is not None: - win_pyd = "_isl_cffi.{}.pyd".format(win_soabi) - else: - win_pyd = "_isl_cffi.pyd" + win_ext_suffix = get_config_var('EXT_SUFFIX') + if win_ext_suffix is None: + win_ext_suffix = ".pyd" + win_pyd = "_isl_cffi{}".format(win_ext_suffix) wrapper_f.write(PY_PREAMBLE.format(win_pyd=win_pyd)) write_enums_to_wrapper(wrapper_f) write_classes_to_wrapper(wrapper_f) -- GitLab From a0e3dd997e4750c78ade934ee7beb2baa37599c2 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 24 Aug 2018 09:12:38 -0500 Subject: [PATCH 5/5] Drop python 2.6 support and mark 3.5, 3.6 as supported --- .gitlab-ci.yml | 10 ---------- setup.py | 3 ++- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 885e6f8..3c1d3c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,16 +29,6 @@ Python 3.5 small integer opt: except: - tags -Python 2.6: - script: - - export PY_EXE=python2.6 - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - - ". ./build-and-test-py-project.sh" - tags: - - python2.6 - except: - - tags - Python 3.6 + Barvinok: script: - git clean -fdx diff --git a/setup.py b/setup.py index 48fc149..ab16279 100644 --- a/setup.py +++ b/setup.py @@ -283,11 +283,12 @@ def main(): 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Multimedia :: Graphics :: 3D Modeling', -- GitLab