From 9da99eb82a1770419b33df630ee1df40860861d5 Mon Sep 17 00:00:00 2001 From: cmccarthy1 <38653604+cmccarthy1@users.noreply.github.com> Date: Fri, 22 Oct 2021 11:07:47 +0100 Subject: [PATCH] Update to support Python 3.9 installations (#108) * Update to p.q logic for handling sys.argv * reintroduction of old logic * addition of initial sys argv and embedpy version check * Update to initialisation logic for embedPy Co-authored-by: Conor McCarthy --- p.q | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/p.q b/p.q index fba3d62..bdb2fcf 100644 --- a/p.q +++ b/p.q @@ -2,19 +2,22 @@ version:@[{EMBEDPYVERSION};0;`development]; -$[(.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+"]]; +o:first string .z.o; +$[o="w";if[3.6>.z.K;'`$"kdb+ version must be 3.6+"];if[3.5>.z.K;'`$"kdb+ version must be 3.5+"]]; 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 `$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["/libpython";`LIBDIR`LDVERSION],"+'.so'";"''"]],pr["__import__('sys').base_prefix"],pr["__import__('sys').prefix"],pr["__import__('sys').executable"],"\"2>",$[.z.o like"w*";"nul ",$[o="w";"nul `$first@[system"python3 ",;c;{system"python ",c}];'"embedPy requires python 3.6 or higher on windows"]; + c:"-c \"",pr[$[o="w";sc["/python";`BINDIR`VERSION];sc["/libpython";`LIBDIR`LDVERSION]],"+'",$[o="w";".dll";o="l";".so";".dylib"],"'"],pr["__import__('sys').base_prefix"],pr["__import__('sys').prefix"],pr["__import__('sys').executable"],"\"2>",$[o="w";"nul ";ei 3;eo];"class"~5#x;$[x[5]in"*>";ei 5;eo];eo]x}]; + e:{$["def"~3#x;$[x[3]in"<*>";ei 3;eo];"class"~5#x;$[x[5]in"*>";ei 5;eo];eo]x} + ]; k)c:{'[y;x]}/|: / compose list of functions k)ce:{'[y;x]}/enlist,|: / compose with enlist (for variadic functions)