Skip to content

Commit ff775be

Browse files
authored
Addition of more rigorous sys.argv check and embedPy version population (#90)
* Update to p.q logic for handling sys.argv * reintroduction of old logic * addition of initial sys argv and embedpy version check
1 parent 54939f0 commit ff775be

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ before_install:
1010
- if [ $TRAVIS_OS_NAME = osx ]; then brew outdated pyenv || brew upgrade pyenv ; export PYTHON_CONFIGURE_OPTS="--enable-framework" ; fi
1111
- PY=$(pyenv install --list | grep -v - |grep -v [a-z]|grep -e '^ 3\.5\..*'|tail -1)
1212
- pyenv install $PY && pyenv local $PY
13+
before_script:
14+
- IMPLEMENTATION=$(if [[ "x$TRAVIS_TAG" == "x" ]]; then echo $TRAVIS_BRANCH-$TRAVIS_COMMIT; else echo $TRAVIS_TAG; fi;)
15+
- perl -p -i -e 's/EMBEDPYVERSION/`\$\"'${IMPLEMENTATION}'\"/g' p.q
1316
script:
1417
- if [ $TRAVIS_OS_NAME = osx ]; then pyenv init - > pyenv.init && source pyenv.init ; fi
1518
- if [ $TRAVIS_OS_NAME = linux ]; then QLIBDIR=l64;OD=$L64; elif [ $TRAVIS_OS_NAME = osx ]; then QLIBDIR=m64;OD=$M64; else echo "unknown OS ('$TRAVIS_OS_NAME')" >&2; exit 1; fi; export QLIBDIR

build/build.bat

+10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
:: Standalone build
22
curl -fsSL -o k.h https://github.com/KxSystems/kdb/raw/master/c/c/k.h || goto :error
33
curl -fsSL -o q.lib https://github.com/KxSystems/kdb/raw/master/w64/q.lib || goto :error
4+
45
::keep original PATH, PATH may get too long otherwise
56
set OP=%PATH%
67
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
8+
9+
if "%APPVEYOR_REPO_TAG%"=="true" (
10+
set EMBEDPY_VERSION=%APPVEYOR_REPO_TAG_NAME%
11+
) else (
12+
set EMBEDPY_VERSION=%APPVEYOR_REPO_BRANCH%_%APPVEYOR_REPO_COMMIT%
13+
)
14+
set PATH=C:\Perl;%PATH%
15+
perl -p -i.bak -e s/EMBEDPYVERSION/`\$\"%EMBEDPY_VERSION%\"/g p.q
16+
717
mkdir w64
818
cl /LD /DKXVER=3 /Fep.dll /O2 py.c q.lib || goto :error
919
move p.dll w64

p.q

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
\d .p
2+
3+
version:@[{EMBEDPYVERSION};0;`development];
4+
25
$[(.z.o like"w*");if[3.6>.z.K;'`$"kdb+ version must be 3.6+"];if[3.5>.z.K;'`$"kdb+ version must be 3.5+"]];
36
if[not .P.loaded:-1h=type@[`.p@;`numpy;`];
47
sc:{"'",x,"'.join([__import__('sysconfig').get_config_var(v)for v in",ssr[.j.j y;"\"";"'"],"])"};pr:{"print(",x,");"};
@@ -104,6 +107,7 @@ sp[`:extend]spq;
104107
{.p.import[`sys;x][:;`:write;{x y;count y}y]}'[`:stdout`:stderr;1 2];
105108
/ set sys.argv
106109
if[not .p.eval["hasattr";.p.import`sys;`argv]`;.p.import[`sys][:;`argv;enlist""]]
110+
if[not loaded;if[not count .p.import[`sys][`:argv]`;.p.import[`sys][:;`:argv;enlist""]]]
107111

108112
/ Cleanup
109113
{![`.p;();0b;x]}`getseq`ntolist`runs`wfunc`gethelp`sp`spq`loaded;

0 commit comments

Comments
 (0)