DINKIN / coreemu

Automatically exported from code.google.com/p/coreemu
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

python broken on source install on Fedora #277

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

source install of CORE on Fedora will put the python modules into 
/usr/local/lib/python2.7/site-packages/core (while most everything else in 
Fedora goes into /usr/lib).

Python seemingly cannot use this directory, even if PYTHONPATH is set to point 
there and sys.path shows the core directory in its path. 

import core
raises "ImportError:  No module named core"

Even if I put a symlink into /usr/lib/python2.7/site-packages/core to point 
there, then 'core' can be imported without exception, but other modules start 
to fail to import (e.g. 'core.api').

I reproduced this on core-4.6, core-4.7, and svn snapshot on a Fedora 20 x86_64 
box.

When I install the Fedora RPMs, it clears the problem.

I saw some other discussion in other forums about how /usr/local/lib may not be 
an ideal place for Python site-packages for Fedora.  I don't know if guidance 
is available somewhere about the preferred prefix for out-of-tree python 
modules in Fedora.

Original issue reported on code.google.com by tomh....@gmail.com on 10 Feb 2015 at 7:10

GoogleCodeExporter commented 8 years ago
A possible workaround could be to do something similar to what the core-daemon 
currently does:

try:
    from core import pycore
except ImportError:
    # hack for Fedora autoconf that uses the following pythondir:
    if "/usr/lib/python2.6/site-packages" in sys.path:
        sys.path.append("/usr/local/lib/python2.6/site-packages")
    if "/usr/lib64/python2.6/site-packages" in sys.path:
        sys.path.append("/usr/local/lib64/python2.6/site-packages")
    if "/usr/lib/python2.7/site-packages" in sys.path:
        sys.path.append("/usr/local/lib/python2.7/site-packages")
    if "/usr/lib64/python2.7/site-packages" in sys.path:
        sys.path.append("/usr/local/lib64/python2.7/site-packages")
    from core import pycore

Original comment by tgo...@gmail.com on 18 Feb 2015 at 7:29

GoogleCodeExporter commented 8 years ago
Possibly, but I wonder whether it should be fixed rather than worked around by 
having CORE install to an acceptable place?  This must be a common problem for 
Fedora and possibly RHEL?  If make uninstall works well enough, can CORE 
install to /usr/lib directly?

Original comment by tomh....@gmail.com on 18 Feb 2015 at 7:38

GoogleCodeExporter commented 8 years ago
This may be resolved by r654/r655.

Original comment by tgo...@gmail.com on 19 Feb 2015 at 2:03

GoogleCodeExporter commented 8 years ago
This should be resolved now.

Original comment by tgo...@gmail.com on 26 May 2015 at 5:52