From 1484c70bd633b448f858cd14d51f4c61d536dc69 Mon Sep 17 00:00:00 2001 From: James Hanna Date: Tue, 4 Sep 2018 19:39:57 +0100 Subject: [PATCH 1/2] block python 3.5 on windows Workaround for python blocking on stdin caused problems on windows 7 --- README.md | 2 +- conda-recipe/conda_build_config.yaml | 2 +- conda-recipe/run_test.bat | 4 ++-- p.q | 2 ++ py.c | 2 +- py.h | 12 ------------ 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 44ee194..b499903 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Please [report issues](https://github.com/KxSystems/embedpy/issues) in this repo ## Requirements - kdb+ ≥ 3.5 64-bit -- Python ≥ 3.5.0 +- Python ≥ 3.5.0 (macOS/Linux) ≥ 3.6.0 windows ## Overview diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml index deef147..38a0cb9 100644 --- a/conda-recipe/conda_build_config.yaml +++ b/conda-recipe/conda_build_config.yaml @@ -1,4 +1,4 @@ python: - - 3.5 + - 3.5 [unix] - 3.6 - 3.7 diff --git a/conda-recipe/run_test.bat b/conda-recipe/run_test.bat index 45ab53e..7b47408 100644 --- a/conda-recipe/run_test.bat +++ b/conda-recipe/run_test.bat @@ -1,9 +1,9 @@ if not defined QLIC ( goto :nokdb ) -call q conda-recipe/prep_requirements.q -q +call q conda-recipe/prep_requirements.q -q ",$[.z.o like"w*";"nul `$first@[system"python3 ",;c;{system"python ",c}];'"embedPy requires python 3.6 or higher on windows"]; c:"-c \"",pr[$[.z.o like"w*";sc["/python";`BINDIR`VERSION],"+'.dll'";sc["/";`LIBDIR`INSTSONAME]]],pr[$[.z.o like"m*";sc["/";`PYTHONFRAMEWORKPREFIX`INSTSONAME];.z.o like"l*";sc["/";`LIBPL`LDLIBRARY];"''"]],pr["__import__('sys').prefix"],"\"2>",$[.z.o like"w*";"nul t!=XD,ktrr())g=g1();a=pq(y)?p1(pg(y) Z K1(setconv){P(xt<100||xt>111,ktrr())r0(cf);cf=r1(x);R 0;}Z K1(getconv){R r1(cf);}Z K1(isp){R kb(pq(x));} ZV*t;EXP K2(init){ZI i=0;I f,g;S l,h;K n,v;P a,b;P(i,0)l=zs(x),h=zs(y);f=pyl(l);free(l);P(!f,krr("libpython")) - Py_SetPythonHome(Py_DecodeLocale(h,0));free(h);P(pyi(),krr("pyinit"));if(PyEval_ThreadsInitialized()&&!PyGILState_Check())t0(PyGILState_GetThisThreadState());PyEval_InitThreads(); + Py_SetPythonHome(Py_DecodeLocale(h,0));free(h);Py_InitializeEx(0);if(PyEval_ThreadsInitialized()&&!PyGILState_Check())t0(PyGILState_GetThisThreadState());PyEval_InitThreads(); M=PyModule_GetDict(PyImport_AddModule("__main__"));cf=k(0,"::",0);n=ktn(KS,0);v=ktn(0,0); if(a=PyImport_ImportModule("numpy.core.multiarray")){N=PyCapsule_GetPointer(b=PyObject_GetAttrString(a,"_ARRAY_API"),0);if(!N||!pyn(N))N=0;p0(b);p0(a);}PyErr_Clear(); #define F(f,i) js(&n,ss(#f));jk(&v,dl(f,i)); diff --git a/py.h b/py.h index 466a5da..9ede435 100644 --- a/py.h +++ b/py.h @@ -116,15 +116,3 @@ ZI pyn(V**v){ #define X(r,n,a,i) U(n=(T##n(*)a)v[i]) NF R 1;} -ZI pyi(){ -#if _WIN32 - I ifd,nfd;HANDLE h; - P(INVALID_HANDLE_VALUE==(h=CreateFile("nul",GENERIC_READ,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL)),-1);P(-1==(nfd=_open_osfhandle((intptr_t)h,0)),(CloseHandle(h),-1)); - P(-1==(ifd=dup(fileno(stdin))),(_close(nfd),-1));P(-1==dup2(nfd,fileno(stdin)),(_close(nfd),_close(ifd),-1)); - Py_InitializeEx(0); - dup2(ifd,fileno(stdin));_close(nfd);_close(ifd); -#else - Py_InitializeEx(0); -#endif - R 0; -} From e9f146416ddfbfad18e775fda4763d0b41a564ed Mon Sep 17 00:00:00 2001 From: James Hanna Date: Tue, 4 Sep 2018 19:40:32 +0100 Subject: [PATCH 2/2] docker deploy condition was incorrect --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d065a1e..1cd41cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,7 +59,7 @@ jobs: skip_cleanup: true on: tags: true - condition: $TRAVIS_BRANCH =~ ^[0-9]+\. && $TRAVIS_REPOSLUG = KxSystems/embedPy + condition: $TRAVIS_BRANCH =~ ^[0-9]+\. - &conda_build stage: deploy_target env: