Skip to content

Commit 393d546

Browse files
committed
gitlab runner config, realpath for macos in test/sys.t, remove unused function from py.h
1 parent c1bd28a commit 393d546

File tree

10 files changed

+187
-19
lines changed

10 files changed

+187
-19
lines changed

.gitlab-ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#TODO test for w64/w32
2+
#TODO test for m64arm
3+
stages:
4+
- build
5+
- test
6+
- deploy
7+
- github
8+
9+
variables:
10+
GIT_DEPTH: 10
11+
workflow:
12+
rules:
13+
- if: '$CI_COMMIT_MESSAGE =~ /^release .*/'
14+
when: never
15+
- when: always
16+
17+
trigger-builds:
18+
stage: build
19+
script: echo trigger build
20+
tags:
21+
- l64
22+
rules:
23+
- if: '$CI_PIPELINE_SOURCE == "push"'
24+
when: manual
25+
26+
build:
27+
stage: build
28+
tags:
29+
- $platform
30+
script:
31+
- VER=$CI_COMMIT_TAG;[ "x$VER" = "x" ] && VER=$CI_COMMIT_BRANCH-$CI_COMMIT_SHA; export VER
32+
- perl -p -i -e 's/EMBEDPYVERSION/`\$\"'${VER}'\"/g' p.q
33+
- make $platform/p.so
34+
artifacts:
35+
expire_in: 2 days
36+
paths:
37+
- p.{k,q}
38+
- $platform/p.so
39+
parallel:
40+
matrix:
41+
- platform: [l64,m64] # TODO win
42+
needs:
43+
- trigger-builds
44+
45+
test-artifacts:
46+
stage: build
47+
tags:
48+
- l64
49+
script: echo package-tests
50+
artifacts:
51+
expire_in: 2 days
52+
paths:
53+
- test.q
54+
- tests/
55+
- ci/makefile
56+
needs:
57+
- trigger-builds
58+
59+
test:
60+
stage: test
61+
tags:
62+
- $platform
63+
variables:
64+
GIT_STRATEGY: none
65+
script: make -f ci/makefile test
66+
dependencies:
67+
- build
68+
- test-artifacts
69+
parallel:
70+
matrix:
71+
- platform: [l64,m64] # TODO m64arm
72+
deploy:
73+
stage: deploy
74+
tags:
75+
- $platform
76+
dependencies:
77+
- build
78+
- test
79+
script: make -f ci/makefile $platform/$target
80+
artifacts:
81+
expire_in: 2 days
82+
paths:
83+
- embedPy-*-$CI_COMMIT_TAG.tgz
84+
rules:
85+
- if: '$CI_COMMIT_TAG == null || $CI_COMMIT_TAG == ""'
86+
when: never
87+
- when: manual
88+
parallel:
89+
matrix:
90+
- platform: l64
91+
target: [docker,github,conda]
92+
- platform: m64
93+
target: [github,conda]
94+
ghrelease:
95+
stage: github
96+
tags:
97+
- l64
98+
script: make -f ci/makefile l64/ghrelease
99+
dependencies:
100+
- deploy
101+
rules:
102+
- if: '$CI_COMMIT_TAG == null || $CI_COMMIT_TAG == ""'
103+
when: never
104+
- when: manual

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# embedPy
22

3-
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/kxsystems/embedPy)](https://github.com/kxsystems/embedpy/releases) [![Travis (.org) branch](https://img.shields.io/travis/kxsystems/embedpy/master?label=travis%20build)](https://travis-ci.org/kxsystems/embedpy/branches) [![AppVeyor branch](https://img.shields.io/appveyor/ci/jhanna-kx/embedpy-ax90d/master?label=appveyor%20build)](https://ci.appveyor.com/project/jhanna-kx/embedpy-ax90d/branch/master)
3+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/kxsystems/embedPy)](https://github.com/kxsystems/embedpy/releases) [![AppVeyor branch](https://img.shields.io/appveyor/ci/jhanna-kx/embedpy-ax90d/master?label=appveyor%20build)](https://ci.appveyor.com/project/jhanna-kx/embedpy-ax90d/branch/master)
44

55
Allows the kdb+ interpreter to manipulate Python objects and call Python functions.
66
Part of the [_Fusion for kdb+_](https://code.kx.com/v2/interfaces/fusion/) interface collection.
@@ -13,17 +13,8 @@ Please [report issues](https://github.com/KxSystems/embedpy/issues) in this repo
1313
## Requirements
1414

1515
- kdb+ ≥ 3.5 64-bit/32-bit(Linux/Arm)
16-
- Python ≥ 3.5.0 (macOS/Linux/Arm) ≥ 3.6.0 windows
17-
- numpy < 1.22
18-
19-
> :warning: **numpy version**: Due to a breaking change with the numpy C api conversions between Python and q arrays is unsupported.
20-
>```
21-
>q)np:.p.import[`numpy]
22-
>q)np[`:__version__]`
23-
>"1.22.1"
24-
>q)np[`:arange][10]`
25-
>foreign
26-
>```
16+
- Python ≥ 3.8.0 (macOS/Linux/Arm) ≥ 3.8.0 windows
17+
2718

2819
## Overview
2920

appveyor.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ image:
33
- Visual Studio 2017
44
artifacts:
55
- path: embedPy_windows-$(appveyor_repo_tag_name).zip
6-
init:
7-
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
8-
96
skip_non_tags: false
107
platform: x64
118
build_script:

ci/conda.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
P=$1;CNDENV=$2;CNDCHN=$3
2+
. "$P/miniconda/etc/profile.d/conda.sh"
3+
set -e
4+
conda create -n $CNDENV conda-build
5+
conda activate $CNDENV
6+
conda install -q -y anaconda-client
7+
EMBEDPY_VERSION=$CI_COMMIT_TAG
8+
export EMBEDPY_VERSION
9+
conda build conda-recipe --output -c $CNDCHN > packagenames.txt
10+
conda build -c $CNDCHN conda-recipe --no-long-test-prefix --no-include-recipe
11+
set +x
12+
CONDATOKEN=$(gpg -d --batch $P/condauploadtoken.gpg)
13+
for pack in $(cat packagenames.txt)
14+
do
15+
anaconda -t $CONDATOKEN upload -l dev $pack
16+
done
17+
conda deactivate
18+
conda env remove -n $CNDENV

ci/makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
ifeq ($(platform),l64)
2+
CNDPLAT := linux-64
3+
CNDURL := https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
4+
RMRPATH := patchelf --remove-rpath
5+
else
6+
CNDPLAT := osx-64
7+
CNDURL := https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
8+
RMRPATH := install_name_tool -delete_rpath @loader_path/../../lib
9+
endif
10+
P ?= $(HOME)/.gitlab-runner
11+
KDBF ?= kdb-4.0-20221026.tar.bz2
12+
KDBURL := https://anaconda.org/kx/kdb/4.0/download/$(CNDPLAT)/$(KDBF)
13+
CNDENV := bld_$(platform)
14+
CNDCHN ?= kx
15+
#prereqs
16+
q: $(P)/q/$(platform)/q
17+
#strip conda rpaths
18+
$(P)/q/$(platform)/q:
19+
curl -O -J -L $(KDBURL)
20+
tar xf $(KDBF) q/q.k q/$(platform)/q
21+
mv q $(P)
22+
$(RMRPATH) $(P)/q/$(platform)/q
23+
24+
conda: $(P)/miniconda/
25+
$(P)/miniconda/:
26+
wget $(CNDURL) -O miniconda.sh
27+
bash miniconda.sh -b -p $(P)/miniconda
28+
. "$(P)/miniconda/etc/profile.d/conda.sh" && \
29+
hash -r && \
30+
conda config --set always_yes yes --set changeps1 no && \
31+
conda update -q conda && \
32+
conda install -q conda-build
33+
#tests
34+
test: q
35+
pip3 install -r tests/requirements.txt
36+
cp $(platform)/p.so .
37+
QHOME=$(P)/q QLIC=$(P) $(P)/q/$(platform)/q test.q -s 4
38+
ci/test_virtualenv.sh
39+
40+
#release and deploy
41+
l64/ghrelease:
42+
gpg -d --batch $(P)/ghtoken.gpg |gh auth login --with-token
43+
gh release create -d -p -R KxSystems/embedpy --generate-notes $(CI_COMMIT_TAG) embedPy-*-$(CI_COMMIT_TAG).tgz
44+
45+
$(platform)/conda: conda
46+
ci/conda.sh $(P) $(CNDENV) $(CNDCHN)
47+
l64/docker:
48+
docker build -t kxsys/embedpy:latest -f docker/Dockerfile .
49+
docker tag kxsys/embedpy:latest kxsys/embedpy:$(CI_COMMIT_TAG)
50+
#echo $(DOCKER_PASSWORD)|docker login --username $(DOCKER_USERNAME) --password-stdin && docker push kxsys/embedpy:latest && docker push kxsys/embedpy:$(CI_COMMIT_TAG)
51+
$(platform)/github:
52+
tar czf embedPy-$(platform)-$(CI_COMMIT_TAG).tgz p.q p.k test.q tests $(platform)/p.so LICENSE README.md

ci/test_virtualenv.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pip3 install virtualenv;
2+
virtualenv test_virtualenv;
3+
. test_virtualenv/bin/activate
4+
pip -q install -r tests/requirements.txt;
5+
q test.q -s 4 -q;
6+

conda-recipe/conda_build_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ target_platform: # [osx]
44
- osx-64 # [osx]
55
- osx-arm64 # [osx]
66
python:
7+
- 3.8
78
- 3.9
89
- 3.10

conda-recipe/run_test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ then
1212
else
1313
echo cross compile, no tests
1414
fi
15-

py.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ typedef struct _p _p,*P;struct _p{L r;P t;L n;union{P*p;P v[1];};};typedef struc
2626
X(V,Py_DecRef,(P))\
2727
X(V,Py_IncRef,(P))\
2828
X(V,PyErr_Clear,())\
29-
X(V,PyErr_Print,())\
3029
X(V,PyErr_Fetch,(P*,P*,P*))\
3130
X(V,PyErr_NormalizeException,(P*,P*,P*))\
3231
X(P,PyErr_BadArgument,())\

tests/sys.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ sysconfig:.p.import`sysconfig
33

44
qPrefix:sys[`:prefix]`
55
qBasePrefix:sys[`:base_prefix]`
6+
rp:{x[y]`}.p.import[`os;`:path.realpath]
67
// Have to remove q path to coincide with python
7-
qPath:":" sv ((sys[`:path]`) except enlist getenv`QHOME)
8+
qPath:":" sv rp each ((sys[`:path]`) except enlist getenv`QHOME)
89
qVersion:3#sys[`:version_info]`
910
qLibdir:sysconfig[`:get_config_var]["LIBDIR"]`
1011

1112
pyPrefix:raze system"python -c \"import sys; print(sys.prefix)\""
1213
pyBasePrefix:raze system"python -c \"import sys; print(sys.base_prefix)\""
13-
pyPath:raze system"python -c \"import sys; print(':'.join(sys.path))\""
14+
pyPath:":"sv rp each ":"vs raze system"python -c \"import sys; print(':'.join(sys.path))\""
1415
pyVersion:"J"$3#system"python -c \"import sys; [print(getattr(sys.version_info,val)) for val in ('major','minor','micro','releaselevel','serial')]\""
1516
pyLibdir:raze system"python -c \"import sysconfig; print(sysconfig.get_config_var('LIBDIR'))\""
1617

0 commit comments

Comments
 (0)