Skip to content

Commit 6b07a5a

Browse files
authored
Merge pull request #59 from KxSystems/windows
Windows
2 parents 9f79bd5 + e9f1464 commit 6b07a5a

File tree

7 files changed

+8
-18
lines changed

7 files changed

+8
-18
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
skip_cleanup: true
6060
on:
6161
tags: true
62-
condition: $TRAVIS_BRANCH =~ ^[0-9]+\. && $TRAVIS_REPOSLUG = KxSystems/embedPy
62+
condition: $TRAVIS_BRANCH =~ ^[0-9]+\.
6363
- &conda_build
6464
stage: deploy_target
6565
env:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Please [report issues](https://github.com/KxSystems/embedpy/issues) in this repo
1212
## Requirements
1313

1414
- kdb+ ≥ 3.5 64-bit
15-
- Python ≥ 3.5.0
15+
- Python ≥ 3.5.0 (macOS/Linux) ≥ 3.6.0 windows
1616

1717

1818
## Overview

conda-recipe/conda_build_config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
python:
2-
- 3.5
2+
- 3.5 [unix]
33
- 3.6
44
- 3.7

conda-recipe/run_test.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
if not defined QLIC (
22
goto :nokdb
33
)
4-
call q conda-recipe/prep_requirements.q -q
4+
call q conda-recipe/prep_requirements.q -q <nul
55
conda install -y -q --file tests\requirements_filtered.txt
6-
call q test.q -s 4 -q || goto :error
6+
call q test.q -s 4 -q <nul || goto :error
77
exit /b 0
88

99
:error

p.q

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
\d .p
22
if[not .P.loaded:-1h=type@[`.p@;`numpy;`];
33
sc:{"'",x,"'.join([__import__('sysconfig').get_config_var(v)for v in",ssr[.j.j y;"\"";"'"],"])"};pr:{"print(",x,");"};
4+
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"];
5+
if[(.z.o like"w*")and `3.6>`$first@[system"python3 ",;c;{system"python ",c}];'"embedPy requires python 3.6 or higher on windows"];
46
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"];
57
`L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
68
.p:(`:./p 2:(`init;2))[L;H]]

py.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -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)
4545
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));}
4646

4747
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"))
48-
Py_SetPythonHome(Py_DecodeLocale(h,0));free(h);P(pyi(),krr("pyinit"));if(PyEval_ThreadsInitialized()&&!PyGILState_Check())t0(PyGILState_GetThisThreadState());PyEval_InitThreads();
48+
Py_SetPythonHome(Py_DecodeLocale(h,0));free(h);Py_InitializeEx(0);if(PyEval_ThreadsInitialized()&&!PyGILState_Check())t0(PyGILState_GetThisThreadState());PyEval_InitThreads();
4949
M=PyModule_GetDict(PyImport_AddModule("__main__"));cf=k(0,"::",0);n=ktn(KS,0);v=ktn(0,0);
5050
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();
5151
#define F(f,i) js(&n,ss(#f));jk(&v,dl(f,i));

py.h

-12
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,3 @@ ZI pyn(V**v){
116116
#define X(r,n,a,i) U(n=(T##n(*)a)v[i])
117117
NF
118118
R 1;}
119-
ZI pyi(){
120-
#if _WIN32
121-
I ifd,nfd;HANDLE h;
122-
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));
123-
P(-1==(ifd=dup(fileno(stdin))),(_close(nfd),-1));P(-1==dup2(nfd,fileno(stdin)),(_close(nfd),_close(ifd),-1));
124-
Py_InitializeEx(0);
125-
dup2(ifd,fileno(stdin));_close(nfd);_close(ifd);
126-
#else
127-
Py_InitializeEx(0);
128-
#endif
129-
R 0;
130-
}

0 commit comments

Comments
 (0)