Skip to content

Commit

Permalink
Merge pull request #59 from KxSystems/windows
Browse files Browse the repository at this point in the history
Windows
  • Loading branch information
jhanna-kx committed Sep 4, 2018
2 parents 9f79bd5 + e9f1464 commit 6b07a5a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion conda-recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python:
- 3.5
- 3.5 [unix]
- 3.6
- 3.7
4 changes: 2 additions & 2 deletions conda-recipe/run_test.bat
Original file line number Diff line number Diff line change
@@ -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 <nul
conda install -y -q --file tests\requirements_filtered.txt
call q test.q -s 4 -q || goto :error
call q test.q -s 4 -q <nul || goto :error
exit /b 0

:error
Expand Down
2 changes: 2 additions & 0 deletions p.q
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
\d .p
if[not .P.loaded:-1h=type@[`.p@;`numpy;`];
sc:{"'",x,"'.join([__import__('sysconfig').get_config_var(v)for v in",ssr[.j.j y;"\"";"'"],"])"};pr:{"print(",x,");"};
c:"-c \"",pr["'.'.join([str(getattr(__import__('sys').version_info,x))for x in ['major','minor']])"],"\"2>",$[.z.o like"w*";"nul <nul";"/dev/null"];
if[(.z.o like"w*")and `3.6>`$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 <nul";"/dev/null"];
`L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
.p:(`:./p 2:(`init;2))[L;H]]
Expand Down
2 changes: 1 addition & 1 deletion py.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Z K3(call){P a,k,p;I g;P(!pq(x)||!pq(z)&&z->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));
Expand Down
12 changes: 0 additions & 12 deletions py.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 6b07a5a

Please sign in to comment.