compile.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Copyright (C) 2008-2014 LAAS-CNRS, JRL AIST-CNRS.
4 #
5 # This file is part of jrl-cmakemodules.
6 # jrl-cmakemodules is free software: you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public License
8 # as published by the Free Software Foundation, either version 3 of
9 # the License, or (at your option) any later version.
10 #
11 # jrl-cmakemodules is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Lesser Public License for more details. You should have
15 # received a copy of the GNU Lesser General Public License along with
16 # jrl-cmakemodules. If not, see <http://www.gnu.org/licenses/>.
17 
18 import sys, os, py_compile
19 
20 srcdir = sys.argv[1]
21 builddir = sys.argv[2]
22 name = sys.argv[3]
23 
24 if srcdir[-1] != '/':
25  srcdir = srcdir + '/'
26 if builddir[-1] != '/':
27  builddir = builddir + '/'
28 
29 src = srcdir + name
30 comp = builddir + name + (__debug__ and 'c' or 'o')
31 
32 #print("compiling " + src + " into " + comp)
33 
34 #os.mkdir(os.path.splittext(comp)[0])
35 
36 try:
37  py_compile.compile(src, comp, doraise=True)
38 except Exception as e:
39  print ("Failed to compile python script: {0}".format (repr (src)))
40  print ("Exception raised: {0}".format (str(e)))
41  sys.exit(1)
42 except:
43  print ("Failed to compile python script: {0}".format (repr (src)))
44  sys.exit(1)


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59