... |
... |
@@ -46,6 +46,18 @@ from distutils import sysconfig |
46
|
46
|
import SCons
|
47
|
47
|
|
48
|
48
|
|
|
49
|
+# Facilitate debugging with pdb.
|
|
50
|
+# At pdb startup, the environment is such that setting breakpoints in
|
|
51
|
+# SConstruct requires specifying its full absolute path, which is incovenient.
|
|
52
|
+# Stopping here at an automatic breakpoint makes this easier. Note that this
|
|
53
|
+# code has no effect unless pdb is loaded.
|
|
54
|
+# To use this, run with pdb and continue from the initial pdb prompt.
|
|
55
|
+pdb_module = sys.modules.get('pdb')
|
|
56
|
+if pdb_module:
|
|
57
|
+ pdb_module.set_trace()
|
|
58
|
+ pass # Breakpoint default file is now SConstruct
|
|
59
|
+
|
|
60
|
+
|
49
|
61
|
# ugly hack from http://www.catb.org/esr/faqs/practical-python-porting/
|
50
|
62
|
# handle python2/3 strings
|
51
|
63
|
def polystr(o):
|
... |
... |
@@ -91,6 +103,28 @@ def _getstatusoutput(cmd, nput=None, shell=True, cwd=None, env=None): |
91
|
103
|
return (status, output)
|
92
|
104
|
|
93
|
105
|
|
|
106
|
+# Workaround for old SCons bug that couldn't overwrite existing symlinks
|
|
107
|
+# This was fixed in 2.3.2, but we allow 2.3.0 (e.g., on Ubuntu 14)
|
|
108
|
+#
|
|
109
|
+# In the troublesome versions, we monkey-patch os.symlink to bully it through
|
|
110
|
+
|
|
111
|
+standard_os_symlink = os.symlink
|
|
112
|
+
|
|
113
|
+def _forced_symlink(source, link_name):
|
|
114
|
+ try:
|
|
115
|
+ standard_os_symlink(source, link_name)
|
|
116
|
+ except OSError:
|
|
117
|
+ # Out of paranoia, only do this when the target is a symlink
|
|
118
|
+ if os.path.islink(link_name):
|
|
119
|
+ os.remove(link_name)
|
|
120
|
+ standard_os_symlink(source, link_name)
|
|
121
|
+ else:
|
|
122
|
+ raise
|
|
123
|
+
|
|
124
|
+if SCons.__version__ in ['2.3.0', '2.3.1']:
|
|
125
|
+ os.symlink = _forced_symlink
|
|
126
|
+
|
|
127
|
+
|
94
|
128
|
# TODO: this list is missing stuff.
|
95
|
129
|
# built man pages found in all_manpages
|
96
|
130
|
generated_sources = [
|
... |
... |
@@ -422,7 +456,7 @@ nonboolopts = ( |
422
|
456
|
("prefix", "/usr/local", "installation directory prefix"),
|
423
|
457
|
("python_coverage", "coverage run", "coverage command for Python progs"),
|
424
|
458
|
("python_libdir", "", "Python module directory prefix"),
|
425
|
|
- ("python_shebang", "/usr/bin/env python", "Python shebang"),
|
|
459
|
+ ("python_shebang", "python", "Python shebang (path or program)"),
|
426
|
460
|
("qt_versioned", "", "version for versioned Qt"),
|
427
|
461
|
("rundir", rundir, "Directory for run-time variable data"),
|
428
|
462
|
("sysroot", "",
|
... |
... |
@@ -2011,6 +2045,9 @@ with open('gpsd.h') as sfp: |
2011
|
2045
|
pythonized_header += ('%s = %s\n' %
|
2012
|
2046
|
(_match3.group(1), _match3.group(2)))
|
2013
|
2047
|
|
|
2048
|
+if not env['python_shebang'].startswith(os.path.sep):
|
|
2049
|
+ env['python_shebang'] = '/usr/bin/env ' + env['python_shebang']
|
|
2050
|
+
|
2014
|
2051
|
# tuples for Substfile. To convert .in files to generated files.
|
2015
|
2052
|
substmap = (
|
2016
|
2053
|
('@ANNOUNCE@', annmail),
|