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
19 import py_compile
20 
21 srcdir = sys.argv[1]
22 builddir = sys.argv[2]
23 name = sys.argv[3]
24 
25 if srcdir[-1] != "/":
26  srcdir = srcdir + "/"
27 if builddir[-1] != "/":
28  builddir = builddir + "/"
29 
30 src = srcdir + name
31 comp = builddir + name + (__debug__ and "c" or "o")
32 
33 # print("compiling " + src + " into " + comp)
34 
35 # os.mkdir(os.path.splittext(comp)[0])
36 
37 try:
38  py_compile.compile(src, comp, doraise=True)
39 except Exception as e:
40  print("Failed to compile python script: {0}".format(repr(src)))
41  print("Exception raised: {0}".format(str(e)))
42  sys.exit(1)


dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Sun Jun 25 2023 02:06:03