ReneVolution / profanity-omemo-plugin

A Python plugin to use (axolotl / Signal Protocol) encryption for the profanity XMPP messenger
GNU General Public License v3.0
64 stars 14 forks source link

Auto-detect Python version Profanity was linked against #24

Closed devurandom closed 6 years ago

devurandom commented 7 years ago

python might not be of the same version that profanity was linked against. profanity -v does not output the version of Python it was linked against, hence we look at its DT_NEEDED to determine the correct Python version.

Fixes: #20

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 40.691% when pulling ebc73cbdf5cdd76aca0840678205f787eb62e749 on devurandom:fix/install.sh-python-version into 8e2b0e394431258fdfd034c22af4625d97b6b2f7 on ReneVolution:master.

ReneVolution commented 7 years ago

Quick test on my Mac says No.

[] ➜ ldd $(which profanity)|grep -oP "^\slibpython\K(\d.\d)"
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
    [-e pattern] [-f file] [--binary-files=value] [--color=when]
    [--context[=num]] [--directories=action] [--label] [--line-buffered]
    [--null] [pattern] [file ...]
-bash: ldd: command not found
ReneVolution commented 7 years ago

Same goes for

[] ➜ scanelf
-bash: scanelf: command not found
ReneVolution commented 7 years ago

A native solution on OSX might be:

otool -L $(which profanity) | grep python | sed -ne 's/.*\/\([0-9].[0-9]\).*$/\1/p'

Please feel free to improve 😸

bascht commented 7 years ago

Or… Two alternatives:

Ask which Python version the plugin should be built against.

All the different approaches (scanelf, otool, ldd, etc) sound way too error prone to me, to be actually reliable and portable across all operating systems Profanity can be built on. So how about just asking for the PATH / Python Version the plugin should be built against?

Add this to profanity --version

We could file an issue over at boothj5/profanity to have profanity --version report the version of Python it was built against. I guess @boothj5 won't oppose.

devurandom commented 7 years ago

@bascht: The profanity --version alternative would have been my choice, too (see my original post). I second it: boothj5/profanity#956

devurandom commented 7 years ago

Upstream added support to master: boothj5/profanity@17b4e45c5795ed191d06964feeb2d20ae7ec6e94

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 40.202% when pulling 47f7dc2742f80fc3b4f44d47f6a18e0d30f058d9 on devurandom:fix/install.sh-python-version into d2df00f48fbc3d1523efc1f1d69f0be78603007c on ReneVolution:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 40.202% when pulling 647a8c88ef5d4415604d0bb66aae030a5a042b7a on devurandom:fix/install.sh-python-version into 982612f9a16068366434771d8f55bbfc3e8d6822 on ReneVolution:master.