[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] x86_64 path proposal

From: David P. Reed
Subject: Re: [Discuss-gnuradio] x86_64 path proposal
Date: Wed, 22 Nov 2006 18:51:39 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20061107 Fedora/ Thunderbird/ Mnenhy/

Eric -

A very clean fix for the path problem on Fedora x86_64 machines is as follows:

in each directory in site-packages/gnuradio modify the __init__.py file to include the following two lines as the first lines after the comments:

import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

and then if the pyexecdir is different from pythondir, create symbolic links from each directory created in pyexecdir to __init__.py in the corresponding directory in pythondir (you could just copy __init__.py).

What this does, for example, is put the above two lines in .../lib/python2.4/site-packages/gnuradio/gr/__init__.py amd a symbolic link to that file in .../lib64/python2.4/site-packages/gnuradio/gr (where the arch-dependent compiled files are installed).

Thus, when you do

    from gnuradio import gr

the path gets changed in the __init__.py to include both directories, and thus gr's pieces all do imports that search both directories.

This seems to me to be clean and "correct". It has the result that if you are running a 32-bit version of python, you just leave lib64 out of PYTHONPATH and the 64-bit-specific code will not be found first. (Fedora should have a lib32/python2.4/site-packages, but it depends on path ordering to do that).

I have tested this and it works swell.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]