/[escript]/release/5.2/site_scons/extractdebbuild.py
ViewVC logotype

Contents of /release/5.2/site_scons/extractdebbuild.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6692 - (show annotations)
Mon Jun 25 02:31:06 2018 UTC (2 years, 11 months ago) by jfenwick
File MIME type: text/x-python
File size: 1981 byte(s)
Fix

1
2 ##############################################################################
3 #
4 # Copyright (c) 2015-2018 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Apache License, version 2.0
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2015-2018 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Apache License, version 2.0
23 http://www.apache.org/licenses/LICENSE-2.0"""
24 __url__="https://launchpad.net/escript-finley"
25
26
27 #Extracts Debian build options
28
29 import subprocess
30 import sys
31
32 def getdebbuildflags():
33 usedflags={'CFLAGS':None, 'CPPFLAGS':'cpp_flags', 'CXXFLAGS':'cxx_extra', 'LDFLAGS':'ld_extra'}
34 ignoreflags=['FFLAGS','FCFLAGS', 'GCJFLAGS','OBJCFLAGS','OBJCXXFLAGS']
35 mycflags=None
36 mycxxflags=None
37 try:
38 deps=subprocess.check_output("dpkg-buildflags")
39 except OSError:
40 return []
41 res=[]
42 deps=deps.split("\n")
43 for line in deps:
44 ind=line.find("=")
45 if ind==-1:
46 continue
47 key=line[:ind]
48 val=line[ind+1:]
49 if key in ignoreflags:
50 continue
51 if key not in usedflags:
52 raise RuntimeError("Unknown key ("+key+") in dpkg-buildflags")
53 if key=="CFLAGS":
54 mycflags=val
55 if key=="CXXFLAGS":
56 mycxxflags=val
57 if mycflags is not None and mycxxflags is not None and mycflags!=mycxxflags:
58 raise RuntimeError("We do not current support different different dpkg-buildflags for C vs C++")
59 if usedflags[key] is None:
60 continue
61 res.append([usedflags[key],val])
62 return res

  ViewVC Help
Powered by ViewVC 1.1.26