Skip to content

Commit

Permalink
Fix to correctly locate python DLL on MS-Windows
Browse files Browse the repository at this point in the history
Also
- Add ci test matrix across different archs, java and python versions.
- Fix a test issue with name reference in the python collections lib.
  • Loading branch information
ikappaki committed Jul 11, 2023
1 parent fee7f41 commit 3055842
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test

on:
push:
- master
pull_request:

jobs:
unit-test:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
jdk: [8, 17, 19]
python-version: ["3.11"]

steps:
- uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}

- name: Install Clojure
uses: DeLaGuardo/setup-clojure@11.0
with:
cli: 1.11.1.1347

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy
- name: Run tests (jdk<17)
if: ${{ matrix.jdk < 17 }}
run: |
clojure -M:test
- name: Run tests (jdk>=17)
if: ${{ matrix.jdk >= 17 }}
run: |
clojure -M:jdk-${{matrix.jdk}}:test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ a.out
*.iml
.lsp
.clj-kondo
pregen-ffi-test
pregen-ffi-test
*~
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Time for a ChangeLog!
## Unreleased
* Fix issue with locating python dll on MS-Windows
[#246](https://github.com/clj-python/libpython-clj/issues/246).

## 2.024
* large dtype-next/hamf upgrade.
* fix for call-attr (it was broken when using keywords).
Expand Down
8 changes: 7 additions & 1 deletion src/libpython_clj2/python/info.clj
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ print(json.dumps(
"Failed to find value python executable. Tried %s"
default-python-executables)))))
python-home (find-python-home system-info options)
platform (:platform system-info)
java-lib-path (java-library-path-addendum python-home)
[ver-maj ver-med _ver-min] (:version system-info)
lib-version (format "%s.%s" ver-maj ver-med)
Expand All @@ -105,7 +106,12 @@ print(json.dumps(
libnames (concat [libname]
;;Make sure we try without the 'm' suffix
(when lib-version
[(str "python" lib-version)]))]
[(str "python" lib-version)])
;; The official python dll
;; does not have a dot in
;; its name.
(when (= platform "win32")
[(str "python" ver-maj ver-med)]))]
(merge
system-info
{:python-home python-home
Expand Down
2 changes: 1 addition & 1 deletion test/libpython_clj2/python_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class Foo:
bridged-dict (py/as-python {"a" 1 "b" 2})
bridged-iter (py/as-python (repeat 5 1))
bridged-list (py/as-python (vec (range 10)))
pycol (py/import-module "collections")
pycol (py/import-module "collections.abc")
mapping-type (py/get-attr pycol "Mapping")
iter-type (py/get-attr pycol "Iterable")
sequence-type (py/get-attr pycol "Sequence")]
Expand Down

0 comments on commit 3055842

Please sign in to comment.