Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and

Wednesday, 2 February 2011

A python script to extract 64 bit opengl binaries (

Well that didn't take long here is my python script for extracting the 64 bit native binaries, on linux for (I'm fairly sure it could be adapted for use on Windows (mainly *.dll to replace *.so).

#!/usr/bin/env python
# script to fix opengl on for 64-bit linux
# needs to be run in the home directory of
# backs-up original 32 bit binaries

import os
import os.path 
import shutil  # cross platform support
import glob
import zipfile

home = os.getcwdu()
processing_dir = os.path.join(home, "")

library_dir = os.path.join(processing_dir, "libraries", "processing", "opengl")
backup_dir = os.path.join(library_dir, "original-native")
unpack_dir = os.path.join(library_dir, "unpack-amd64")
if (os.path.exists(backup_dir)):
    os.mkdir(backup_dir, 0777)
if (os.path.exists(unpack_dir)):
    os.mkdir(unpack_dir, 0777)  

alljars = glob.glob(os.path.join(library_dir,"*.jar")) 
jars64 = []
for jar in alljars:
    if jar.endswith("linux-amd64.jar"):

for jar64 in jars64:
    zfobj = zipfile.ZipFile(jar64)
    for name in zfobj.namelist():
        if (name.endswith('/')):
        elif (name.endswith(".so")):
            outfile = open(os.path.join(unpack_dir, name), 'wb')

libraries = glob.glob(os.path.join(unpack_dir, "*.so"))
for so_file in libraries:
        src = os.path.join(library_dir, os.path.basename(so_file))
        if (not os.path.exists(os.path.join(backup_dir, os.path.basename(so_file)))):
            shutil.move(src, backup_dir)
            shutil.copy(so_file, library_dir) 

No comments:

Post a Comment


Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby- and processing-3.2.2