Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meson cannot find pykeepass module, I am certain it is installed

I am attempting to build an application using meson, Gnome PasswordSafe. I have successfully built it on Arch, but have since moved to PureOS (Debian).

When running:

 $ meson . _build --prefix=/usr

it tells me:

meson.build:36:4: ERROR: Problem encountered: Missing dependency pykeepass >= master

What am I missing?

Thanks!


I installed pykeepass using pip. When that did not work, I tried using pip3. When that did not work, I tried both again, but with sudo. Still no dice.

I then installed it from the repo/source (https://github.com/pschmitt/pykeepass). No dice.


Currently, python help recognizes pykeepass as being installed to:

/home/dc3p/.local/lib/python3.7/site-packages/pykeepass/__init__.py
/usr/local/lib/python3.7/dist-packages/pykeepass/__init__.py
/home/dc3p/.local/lib/python2.7/site-packages/pykeepass/__init__.py
/usr/local/lib/python2.7/dist-packages/pykeepass/__init__.py

pip and pip3 list shows pykeepass as being present.

While I have it installed in all four locations currently, I have also tried while having only one installed at any location at a time.

I have also tried the meson command without and with sudo. Regardless of what I do, meson throws the same error.

Expected result is a build.

like image 469
dc3p Avatar asked Aug 01 '19 19:08

dc3p


1 Answers

The meson.build file in PasswordSafe is testing for the presence of a directory in the file system which can lead to false negatives if the installation directory varies. See the code extract below.

# Python Module Check
pykeepass_dir = join_paths(python_dir, 'pykeepass')
construct_dir = join_paths(python_dir, 'construct')

if run_command('[', '-d', pykeepass_dir, ']').returncode() != 0
    error('Missing dependency pykeepass >= master')
endif

if run_command('[', '-d', construct_dir, ']').returncode() != 0
    error('Missing dependency python-construct >= 2.9.45')
endif

You can replace the above with the following to test for dependencies based on imports:

python3_required_modules = ['pykeepass', 'construct']

foreach p : python3_required_modules
    script = 'import importlib.util; import sys; exit(1) if importlib.util.find_spec(\''+ p +'\') is None else exit(0)'
    if run_command(python_bin, '-c', script).returncode() != 0
        error('Required Python3 module \'' + p + '\' not found')
    endif
endforeach

This should solve the issue providing that pykeepass is within your path.

like image 91
Jacques Gaudin Avatar answered Nov 08 '22 23:11

Jacques Gaudin