compile.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 # Copyright 2011, Thomas Moulard, JRL, CNRS/AIST
00004 #
00005 # This file is part of jrl-cmakemodules.
00006 # jrl-cmakemodules is free software: you can redistribute it and/or
00007 # modify it under the terms of the GNU Lesser General Public License
00008 # as published by the Free Software Foundation, either version 3 of
00009 # the License, or (at your option) any later version.
00010 #
00011 # jrl-cmakemodules is distributed in the hope that it will be useful, but
00012 # WITHOUT ANY WARRANTY; without even the implied warranty of
00013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 # General Lesser Public License for more details.  You should have
00015 # received a copy of the GNU Lesser General Public License along with
00016 # jrl-cmakemodules. If not, see <http://www.gnu.org/licenses/>.
00017 
00018 import sys, os, py_compile
00019 
00020 srcdir = sys.argv[1]
00021 builddir = sys.argv[2]
00022 name = sys.argv[3]
00023 
00024 if srcdir[-1] != '/':
00025     srcdir = srcdir + '/'
00026 if builddir[-1] != '/':
00027     builddir = builddir + '/'
00028 
00029 src = srcdir + name
00030 comp = builddir + name + (__debug__ and 'c' or 'o')
00031 
00032 #print("compiling " + src + " into " + comp)
00033 
00034 #os.mkdir(os.path.splittext(comp)[0])
00035 
00036 try:
00037     py_compile.compile(src, comp, doraise=True)
00038 except Exception, e:
00039     print ("Failed to compile python script: {0}".format (repr (src)))
00040     print ("Exception raised: {0}".format (str(e)))
00041     sys.exit(1)
00042 except:
00043     print ("Failed to compile python script: {0}".format (repr (src)))
00044     sys.exit(1)


robot_capsule_urdf
Author(s): Antonio El Khoury
autogenerated on Mon Oct 6 2014 04:10:28