/[escript]/branches/4.1deb/site_scons/extractdebbuild.py
ViewVC logotype

Contents of /branches/4.1deb/site_scons/extractdebbuild.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5836 - (show annotations)
Fri Nov 27 00:03:56 2015 UTC (3 years, 6 months ago) by jfenwick
File MIME type: text/x-python
File size: 1991 byte(s)
backporting debianising fixes from after 4.1 --- do not merge back into trunk

1
2 ##############################################################################
3 #
4 # Copyright (c) 2015 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
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 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Open Software License version 3.0
23 http://www.opensource.org/licenses/osl-3.0.php"""
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