Skip to content

Commit 5667374

Browse files
committed
Fix to correctly locate python DLL on MS-Windows
Also - Add ci test matrix across different archs, java and python versions. - Fix a test issue with name reference in the python collections lib.
1 parent fee7f41 commit 5667374

File tree

5 files changed

+66
-3
lines changed

5 files changed

+66
-3
lines changed

Diff for: .github/workflows/test.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '**/README.md'
9+
- '**/CHANGELOG.md'
10+
pull_request:
11+
12+
jobs:
13+
unit-test:
14+
runs-on: ${{matrix.os}}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [macos-latest, ubuntu-latest, windows-latest]
19+
jdk: [8, 17, 19]
20+
python-version: ["3.11"]
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Set up JDK ${{ matrix.jdk }}
26+
uses: actions/setup-java@v1
27+
with:
28+
java-version: ${{ matrix.jdk }}
29+
30+
- name: Install Clojure
31+
uses: DeLaGuardo/[email protected]
32+
with:
33+
cli: 1.11.1.1347
34+
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v4
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Install dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install numpy
44+
45+
- name: Run tests (jdk<17)
46+
if: ${{ matrix.jdk < 17 }}
47+
run: |
48+
clojure -M:test
49+
- name: Run tests (jdk>=17)
50+
if: ${{ matrix.jdk >= 17 }}
51+
run: |
52+
clojure -M:jdk-${{matrix.jdk}}:test

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ a.out
2020
*.iml
2121
.lsp
2222
.clj-kondo
23-
pregen-ffi-test
23+
pregen-ffi-test
24+
*~

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Time for a ChangeLog!
2+
## Unreleased
3+
* Fix issue with locating python dll on MS-Windows
4+
[#246](https://github.com/clj-python/libpython-clj/issues/246).
5+
26
## 2.024
37
* large dtype-next/hamf upgrade.
48
* fix for call-attr (it was broken when using keywords).

Diff for: src/libpython_clj2/python/info.clj

+7-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ print(json.dumps(
9696
"Failed to find value python executable. Tried %s"
9797
default-python-executables)))))
9898
python-home (find-python-home system-info options)
99+
platform (:platform system-info)
99100
java-lib-path (java-library-path-addendum python-home)
100101
[ver-maj ver-med _ver-min] (:version system-info)
101102
lib-version (format "%s.%s" ver-maj ver-med)
@@ -105,7 +106,12 @@ print(json.dumps(
105106
libnames (concat [libname]
106107
;;Make sure we try without the 'm' suffix
107108
(when lib-version
108-
[(str "python" lib-version)]))]
109+
[(str "python" lib-version)])
110+
;; The official python dll
111+
;; does not have a dot in
112+
;; its name.
113+
(when (= platform "win32")
114+
[(str "python" ver-maj ver-med)]))]
109115
(merge
110116
system-info
111117
{:python-home python-home

Diff for: test/libpython_clj2/python_test.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class Foo:
365365
bridged-dict (py/as-python {"a" 1 "b" 2})
366366
bridged-iter (py/as-python (repeat 5 1))
367367
bridged-list (py/as-python (vec (range 10)))
368-
pycol (py/import-module "collections")
368+
pycol (py/import-module "collections.abc")
369369
mapping-type (py/get-attr pycol "Mapping")
370370
iter-type (py/get-attr pycol "Iterable")
371371
sequence-type (py/get-attr pycol "Sequence")]

0 commit comments

Comments
 (0)