getAndBuildARToolkit.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 from sys import exit
00003 from subprocess import call
00004 from subprocess import Popen
00005 from subprocess import PIPE
00006 from os import chdir
00007 from urllib import urlopen
00008 from os.path import isfile
00009 
00010 if __name__ == "__main__":
00011         dot = Popen("rospack find ar_recog".split(' '), stdout=PIPE).communicate()[0]
00012         dot = dot[0:-1]
00013 
00014         if not isfile(dot + '/src/ARToolKit-2.72.1.tgz'):
00015                 print "Downloading ARToolkit..."
00016 
00017                 chdir(dot + "/src");
00018 
00019                 try:
00020                         stream = urlopen('http://sourceforge.net/projects/artoolkit/files/artoolkit/2.72.1/ARToolKit-2.72.1.tgz/download')
00021                         archive = open('ARToolKit-2.72.1.tgz','w')
00022                         archive.write(stream.read())
00023                         stream.close()
00024                         archive.close()
00025                 except IOError:
00026                         print "Problem retrieving ARToolkit!"
00027                         exit(-1)
00028 
00029         print "Decompressing..."
00030 
00031         chdir(dot + "/src");
00032         call("tar xzf ARToolKit-2.72.1.tgz".split(' '))
00033 
00034         print "Patching..."
00035 
00036         chdir(dot + "/src/ARToolKit")
00037 
00038         try:
00039                 patch = open('staticConfig.patch','w')
00040                 patch.write("""40c40
00041 <     read ANS
00042 ---
00043 >     ANS="5"
00044 124c124
00045 <     read ANS
00046 ---
00047 >     ANS="n"
00048 182c182
00049 < read ANS
00050 ---
00051 > ANS="y"
00052 """)
00053                 patch.close()
00054 
00055                 call("patch Configure staticConfig.patch".split(' '))
00056         except:
00057                 print "Problem patching Configure!"
00058                 exit(-1)
00059 
00060         print "Building ARToolkit..."
00061 
00062         call("./Configure")
00063         call("make")
00064 
00065         print "ARToolkit retrieved and Built. Copying object.c"
00066 
00067         call(('mkdir -p ' + dot + '/build/src/ARToolKit/examples/loadMultiple').split(' '))
00068         call(('cp ' + dot + '/src/ARToolKit/examples/loadMultiple/object.c ' + dot + '/build/src/ARToolKit/examples/loadMultiple/.').split(' '))
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


ar_recog
Author(s): Graylin Trevor Jay and Christopher Crick
autogenerated on Fri Jan 25 2013 12:15:00