@yufaazhi, You're a class act - this is incredibly helpful mate, and thank you so much for registering and posting this, for the help of others!
(Just downloaded and tested this trick in an ubuntu 18.04.6 live iso)
Edit:
@Cas, Would you consider doing this in your build-script for the python3-libtorrent package specifically for 18.04 ubuntu, on your PPA thanks, if possible I mean. (Rename not link I mean).
Well, probably should be fixed upstream instead I guess, since not a deluge issue that the module isn't importable/usable from python, but not sure if PPA build-script or source that's the issue here though.
It states in 'setup.py' about output name:
Code: Select all
# b2 doesn't provide a way to signal the name or paths of its outputs.
# We try to convince python.jam to name its output file like our target
# and copy it to our target directory. See comments in
# write_b2_python_config for limitations on controlling the filename.
- and it's 'write_b2_python_config() comments':
Code: Select all
# Note that all else being equal, we'd like to exactly control the output
# filename, so distutils can find it. However:
# 1. We can only control part of the filename; the prefix is controlled by
# our Jamfile and the final suffix is controlled by python.jam.
# 2. Debian patched python.jam to disregard the configured ext_suffix
# anyway; they always override it with the same sysconfig var we use,
# found by invoking the executable.
# So instead of applying an arbitrary name, we just try to guarantee that
# b2 produces a name that distutils would expect, on all platforms. In
# other words we apply debian's override everywhere, and hope no other
# overrides ever disagree with us.
# Note that sysconfig and distutils.sysconfig disagree here, especially on
# windows.
ext_suffix = distutils.sysconfig.get_config_var("EXT_SUFFIX")
# python.jam appends the platform-specific final suffix on its own. I can't
# find a consistent value from sysconfig or distutils.sysconfig for this.
for plat_suffix in (".pyd", ".dll", ".so", ".sl"):
if ext_suffix.endswith(plat_suffix):
ext_suffix = ext_suffix[: -len(plat_suffix)]
break
write(f" : {b2_escape(ext_suffix)}")
write(" ;\n")
BTW, I built python3-libtorrent using b2 direct, not using setup.py, and I know the working older version from lbry on pypi also did, so maybe something in setup.py is the culprit here. *Though just checked that on a newer ubuntu then python3-libtorrent also using same naming-scheme and not just named libtorrent.so, and with same *egg-info dir contents, but still works('import libtorrent').