eonpatapon / mpDris2

MPRIS V2.1 support for mpd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python 3 support. ModuleNotFoundError: No module named 'mpd'

DolphinStKom opened this issue · comments

Need integration for Python 3. When I use any of the branches that get an error

mpDris2
Traceback (most recent call last):
File "/usr/bin/mpDris2", line 29, in
import mpd
ModuleNotFoundError: No module named 'mpd'

as the default in the system python 3.
If you change the file /usr/bin/mpris2 and explicitly specify it python version 2, it works. Please correct it please to at least Python 3 branch worked with Python 3.

So install a Python 3-compatible mpd module?

Excuse me, but do not tell me how to do it? I do not see him having such keys

media-sound/mpd-0.20.4::gentoo USE="alsa bzip2 cdio curl eventfd faad ffmpeg fifo flac glib icu id3tag inotify ipv6 lame libmpdclient mad mpg123 network ogg pulseaudio signalfd systemd tcpd twolame unicode vorbis wavpack zlib -adplug -ao -audiofile -debug -expat -fluidsynth -gme -jack -libav -libsamplerate -libsoxr -mikmod -mms -modplug -musepack -nfs -openal -opus -oss -pipe -recorder -samba (-selinux) -sid -sndfile -soundcloud -sqlite -upnp -wildmidi -zeroconf -zip"

in system

sudo eselect python list
Пароль: 
Available Python interpreters, in order of preference:
  [1]   python3.4
  [3]   python3.6 (fallback)
  [4]   python2.7 (fallback)

mpDris2 from git, I tried to use the master and python3 branches

my ebuild

# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="5"
#PYTHON_COMPAT=( python{3_2,3_3} )
#need change python > python-r1

inherit python autotools eutils git-2

MY_PN="${PN/d/D}"

DESCRIPTION="An implementation of the MPRIS 2 interface as a client for MPD"
HOMEPAGE="http://github.com/eonpatapon/mpDris2"
EGIT_REPO_URI="git://github.com/eonpatapon/mpDris2.git"
#EGIT_BRANCH="python-3"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
IUSE=""

DEPEND=">=dev-lang/python-2.4
		>=dev-python/dbus-python-0.80
		>=dev-python/pygobject-2.14
		>=dev-python/python-mpd-0.3.0"

src_prepare() {
	eautoreconf
}

src_install() {
	emake install DESTDIR="${D}" || die "Failed to install"
}

I'm using https://github.com/Mic92/python-mpd2 with python3 and it works fine

hm, I'm using

eix python-mpd
[I] dev-python/python-mpd
     Доступные версии:      0.5.4 0.5.5 {test PYTHON_TARGETS="pypy python2_7 python3_4 python3_5"}
     Установленные версии:  0.5.5(21:47:19 03.03.2017)(-test PYTHON_TARGETS="python2_7 python3_4 -pypy -python3_5")
     Домашняя страница:     https://github.com/Mic92/python-mpd2
     Описание:              Python MPD client library

Do you think the problem is in it?

equery files python-mpd
 * Searching for python-mpd ...
 * Contents of dev-python/python-mpd-0.5.5:
/usr
/usr/lib64
/usr/lib64/python2.7
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/mpd.py
/usr/lib64/python2.7/site-packages/mpd.pyc
/usr/lib64/python2.7/site-packages/mpd.pyo
/usr/lib64/python2.7/site-packages/mpd_test.py
/usr/lib64/python2.7/site-packages/mpd_test.pyc
/usr/lib64/python2.7/site-packages/mpd_test.pyo
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/PKG-INFO
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/SOURCES.txt
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/dependency_links.txt
/usr/lib64/python2.7/site-packages/python_mpd2-0.5.5-py2.7.egg-info/top_level.txt
/usr/lib64/python3.4
/usr/lib64/python3.4/site-packages
/usr/lib64/python3.4/site-packages/__pycache__
/usr/lib64/python3.4/site-packages/__pycache__/mpd.cpython-34.pyc
/usr/lib64/python3.4/site-packages/__pycache__/mpd.cpython-34.pyo
/usr/lib64/python3.4/site-packages/__pycache__/mpd_test.cpython-34.pyc
/usr/lib64/python3.4/site-packages/__pycache__/mpd_test.cpython-34.pyo
/usr/lib64/python3.4/site-packages/mpd.py
/usr/lib64/python3.4/site-packages/mpd_test.py
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/PKG-INFO
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/SOURCES.txt
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/dependency_links.txt
/usr/lib64/python3.4/site-packages/python_mpd2-0.5.5-py3.4.egg-info/top_level.txt

If I understood correctly

But it does not work either with a master branch or with a branch python3...
I have to change the file /usr/bin/mpris2 after installation or reinstallation and explicitly specify it python version 2.

Its work after comand
`python -c "import mpd"
set python 3.4 (not work with 3.6)
not set EGIT_BRANCH="python-3"

final ebuild

# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="5"
PYTHON_COMPAT=( python3_{4,5,6} )

inherit python-r1 autotools eutils git-r3

MY_PN="${PN/d/D}"

DESCRIPTION="An implementation of the MPRIS 2 interface as a client for MPD"
HOMEPAGE="http://github.com/eonpatapon/mpDris2"
EGIT_REPO_URI="git://github.com/eonpatapon/mpDris2.git"
#EGIT_BRANCH="python-3"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
IUSE=""

LANGS="fr nl"

for lang in ${LANGS}; do
	IUSE+=" linguas_${lang}"
done

DEPEND=">=dev-lang/python-2.4
		>=dev-python/dbus-python-0.80
		>=dev-python/pygobject-2.14
		>=dev-python/python-mpd-0.3.0"

DOCS="AUTHORS COPYING INSTALL NEWS README README.md"

src_prepare() {
	eautoreconf
}

_clean_up_locales() {
	einfo "Cleaning up locales..."
	for lang in ${LANGS}; do
		use "linguas_${lang}" && {
			einfo "- keeping ${lang}"
			continue
		}
		rm -Rf "${ED}"/usr/share/locale/"${lang}" || die
	done
}

src_install() {
	emake install DESTDIR="${D}" || die "Failed to install"

	_clean_up_locales

}

This is normal? And how often and when do I need to do this import?

You don't – the command is only for testing whether Python can import that module.

For Python 3.6, you will need to install python-mpd2 (git).