pkgsrc-Users archive

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

Re: NetBSD5.1/amd64 + python26 + py-OpenGL/pkgsrc-HEAD

On Tue, Mar 15, 2011 at 10:37:11PM -0400, Dave B wrote:
>   Anyone having success (or troubles as well) with the above combo?
>   I optimistically tried simply adding "26" to the
> line of my copy of pkgsrc/graphics/py-OpenGL/Makefile; and while
> the package then built and installed just fine, I end up getting
> errors at run-time that I haven't been fully able to get past,
> e.g.,
>     >>> import OpenGL.GL
>     .
>     .
>     .
>     ImportError: ('Unable to load OpenGL library', 'Shared object "" 
> not found', '', None)
>     >>>
> Then, even if I work around that by adding /usr/X11R7/lib to
> sys.path (which doesn't quite seem like a correct fix; is it?), I
> still get the more elusive
>     >>> import OpenGL.GL
>     .
>     .
>     .
>       File "/usr/pkg/lib/python2.6/site-packages/OpenGL/platform/", 
> line 3, in <module>
>         from OpenGL.platform import baseplatform, ctypesloader
>     ImportError: cannot import name baseplatform
>     >>>

  For the archives:

  I got past this problem by altering one of the files in my
installation of py26-OpenGL; and then making symlinks to the
needed X11/OpenGL shared libraries from within an extra
directory I manually created,


(to match what I added to the altered file; see diff).

  Now I can use OpenGL from python26; but, I recognize this is not
a reasonable workaround in the NetBSD spirit of correctness.  Since
it works, however, I'm still posting it in hopes that maybe it'll
be just enough inspiration to get people to suggest how to do this
the right way--and also, in case someone needs the functionality in
a pinch.

Cheers,  --Dave B.
Boston, MA

P.S.  I think the reason for the "import baseplatform" failure in
my earlier posting was that an "import baseplatform" had already
been attempted from elsewhere in the code--and had failed... (due
to the issue), and that that unsuccessful result was
somehow cached within python's import mechanics; so, indeed, the problem did have to be solved via a better, earlier,
method than my sys.path approach (and then everything would fall
into place with baseplatform).
--- /usr/pkg/lib/python2.6/site-packages/OpenGL/platform/   
2009-11-25 14:49:20.000000000 -0500
+++ /usr/pkg/lib/python2.6/site-packages/OpenGL/platform/        
2011-03-17 07:38:37.000000000 -0400
@@ -13,7 +13,7 @@
 import OpenGL
 DLL_DIRECTORY = os.path.join( os.path.dirname( OpenGL.__file__ ), 'DLLS' )
+LIB_DIRECTORY = os.path.join( os.path.dirname( OpenGL.__file__ ), 'lib' )
 def loadLibrary( dllType, name, mode = ctypes.RTLD_GLOBAL ):
@@ -45,6 +45,8 @@
             name = fullName
         elif os.path.isfile( os.path.join( DLL_DIRECTORY, name + '.dll' )):
             name = os.path.join( DLL_DIRECTORY, name + '.dll' )
+        elif os.path.isfile( os.path.join( LIB_DIRECTORY, name )):
+            name = os.path.join( LIB_DIRECTORY, name )
     except Exception, err: '''Failed on util.find_library( %r ): %s''', name, err )
         # Should the call fail, we just try to load the base filename...

Home | Main Index | Thread Index | Old Index