Skip to content

Commit

Permalink
Merge pull request #1 from martin-belanger/main
Browse files Browse the repository at this point in the history
fix github workflow
  • Loading branch information
martin-belanger authored Jan 26, 2022
2 parents e5b2e00 + 0f8f8d4 commit 9b84a86
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/meson-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: nvme-stas CI

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

workflow_dispatch:

Expand Down Expand Up @@ -35,6 +35,7 @@ jobs:
repository: martin-belanger/libnvme-tp8010
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
path: libnvme-tp8010
ref: kernel-dim

- name: Build and install libnvme-tp8010
run: |
Expand All @@ -45,7 +46,7 @@ jobs:
sudo meson install
- name: Configure nvme-stas
run: meson .build
run: meson .build -Dcheck_pymodules=false

- name: Test
run: |
Expand Down
28 changes: 20 additions & 8 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,32 @@ want_man = get_option('man')
want_html = get_option('html')

# Check that we have all the right Python3 dependencies
py_modules_reqd = ['libnvme', 'dasbus', 'pyudev', 'systemd']
if want_man or want_html
py_modules_reqd += 'lxml'
endif

python3 = import('python').find_installation('python3', modules: py_modules_reqd)
python3 = import('python').find_installation('python3')
python_version = python3.language_version()
python_version_req = '>=3.6'
if not python_version.version_compare(python_version_req)
error('Python @0@ required. Found @1@ instead'.format(python_version_req, python_version))
endif

if run_command(python3, '-c', 'from gi.repository import GObject').returncode() != 0
error('Required GObject python3 module not found. Usually comes from python3-gi (deb) OR python3-gobject (yum)')
check_pymodules = get_option('check_pymodules')
if check_pymodules
py_modules_reqd = [
['libnvme', 'This library must be installed from sources (at this time)'],
['dasbus', 'Install python3-dasbus (yum) OR pip3 install dasbus'],
['pyudev', 'Install python3-pyudev (deb/yum)'],
['systemd', 'Install python3-systemd (deb/yum)'],
['gi.repository.GObject', 'Install python3-gi (deb) OR python3-gobject (yum)'],
]
if want_man or want_html
py_modules_reqd += [['lxml', 'Install python3-lxml (deb/yum)']]
endif
foreach p : py_modules_reqd
# Source: https://docs.python.org/3/library/importlib.html#checking-if-a-module-can-be-imported
script = 'import importlib.util, sys; sys.exit(0 if importlib.util.find_spec("@0@") is not None else 1)'
if run_command(python3, '-c', script.format(p[0])).returncode() != 0
error('Required python3 module "@0@" not found. @1@'.format(p[0], p[1]))
endif
endforeach
endif

pylint = find_program('pylint', required: false)
Expand Down
5 changes: 3 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- mode: meson -*-

option('man', type : 'boolean', value : false, description : 'build and install man pages')
option('html', type : 'boolean', value : false, description : 'build and install html pages')
option('man', type: 'boolean', value: false, description: 'build and install man pages')
option('html', type: 'boolean', value: false, description: 'build and install html pages')
option('check_pymodules', type: 'boolean', value: true, description: 'whether to look for missing python module')

0 comments on commit 9b84a86

Please sign in to comment.