Skip to content

Commit 0d20704

Browse files
committed
Bug 785871 - Make config.status importable. r=gps
1 parent 10395d8 commit 0d20704

File tree

4 files changed

+58
-54
lines changed

4 files changed

+58
-54
lines changed

Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ endif
6969
include $(topsrcdir)/config/config.mk
7070

7171
GARBAGE_DIRS += dist _javagen _profile _tests staticlib
72-
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
72+
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
7373
config/autoconf.mk \
7474
unallmakefiles mozilla-config.h \
7575
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \

build/autoconf/config.status.m4

+28-26
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define([AC_SUBST],
1313
[ifdef([AC_SUBST_$1], ,
1414
[define([AC_SUBST_$1], )dnl
1515
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
16-
(''' $1 ''', r''' [$]$1 ''')
16+
(''' $1 ''', r''' [$]$1 ''')
1717
AC_DIVERT_POP()dnl
1818
])])
1919

@@ -26,7 +26,7 @@ dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
2626
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
2727
define([AC_DEFINE],
2828
[cat >> confdefs.pytmp <<\EOF
29-
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
29+
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
3030
EOF
3131
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
3232
])
@@ -36,7 +36,7 @@ dnl python.
3636
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
3737
define([AC_DEFINE_UNQUOTED],
3838
[cat >> confdefs.pytmp <<EOF
39-
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
39+
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
4040
EOF
4141
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
4242
])
@@ -80,24 +80,19 @@ cat > $CONFIG_STATUS <<EOF
8080
#!${PYTHON}
8181
# coding=$encoding
8282
83-
import os, sys
83+
import os
8484
dnl topsrcdir is the top source directory in native form, as opposed to a
8585
dnl form suitable for make.
8686
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
8787
if not os.path.isabs(topsrcdir):
8888
topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
89-
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
90-
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
91-
from ConfigStatus import config_status
9289
93-
args = {
94-
'topsrcdir': topsrcdir,
95-
'topobjdir': os.path.dirname(<<<__file__>>>),
90+
topobjdir = os.path.dirname(<<<__file__>>>)
9691
9792
dnl All defines and substs are stored with an additional space at the beginning
9893
dnl and at the end of the string, to avoid any problem with values starting or
9994
dnl ending with quotes.
100-
'defines': [(name[1:-1], value[1:-1]) for name, value in [
95+
defines = [(name[1:-1], value[1:-1]) for name, value in [
10196
EOF
10297
10398
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
@@ -106,9 +101,9 @@ sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
106101
rm confdefs.pytmp confdefs.h
107102
108103
cat >> $CONFIG_STATUS <<\EOF
109-
] ],
104+
] ]
110105
111-
'substs': [(name[1:-1], value[1:-1]) for name, value in [
106+
substs = [(name[1:-1], value[1:-1]) for name, value in [
112107
EOF
113108
114109
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
@@ -118,51 +113,58 @@ undivert(MOZ_DIVERSION_SUBST)dnl
118113
EOF
119114
120115
cat >> $CONFIG_STATUS <<\EOF
121-
] ],
116+
] ]
122117
123118
dnl List of files to apply AC_SUBSTs to. This is the list of files given
124119
dnl as an argument to AC_OUTPUT ($1)
125-
'files': [
120+
files = [
126121
EOF
127122
128123
for out in $1; do
129-
echo " '$out'," >> $CONFIG_STATUS
124+
echo " '$out'," >> $CONFIG_STATUS
130125
done
131126
132127
cat >> $CONFIG_STATUS <<\EOF
133-
],
128+
]
134129
135130
dnl List of header files to apply AC_DEFINEs to. This is stored in the
136131
dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
137-
'headers': [
132+
headers = [
138133
EOF
139134
140135
ifdef(<<<AC_LIST_HEADER>>>, <<<
141136
HEADERS="AC_LIST_HEADER"
142137
for header in $HEADERS; do
143-
echo " '$header'," >> $CONFIG_STATUS
138+
echo " '$header'," >> $CONFIG_STATUS
144139
done
145140
>>>)dnl
146141
147142
cat >> $CONFIG_STATUS <<\EOF
148-
],
143+
]
149144
150145
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
151-
'non_global_defines': [
146+
non_global_defines = [
152147
EOF
153148
154149
if test -n "$_NON_GLOBAL_ACDEFINES"; then
155150
for var in $_NON_GLOBAL_ACDEFINES; do
156-
echo " '$var'," >> $CONFIG_STATUS
151+
echo " '$var'," >> $CONFIG_STATUS
157152
done
158153
fi
159154
160-
cat >> $CONFIG_STATUS <<\EOF
161-
]
162-
}
155+
cat >> $CONFIG_STATUS <<EOF
156+
]
157+
158+
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs', 'files', 'headers']
163159
164160
dnl Do the actual work
165-
config_status(**args)
161+
if __name__ == '__main__':
162+
args = dict([(name, globals()[name]) for name in __all__])
163+
import sys
164+
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
165+
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
166+
from ConfigStatus import config_status
167+
config_status(**args)
166168
EOF
167169
changequote([, ])
168170
chmod +x $CONFIG_STATUS

js/src/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ ifndef HAVE_DTRACE
595595
endif
596596
endif
597597

598-
DIST_GARBAGE = config.cache config.log config.status \
598+
DIST_GARBAGE = config.cache config.log config.status* \
599599
config/autoconf.mk \
600600
unallmakefiles js-config js-config.h js-confdefs.h
601601

js/src/build/autoconf/config.status.m4

+28-26
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define([AC_SUBST],
1313
[ifdef([AC_SUBST_$1], ,
1414
[define([AC_SUBST_$1], )dnl
1515
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
16-
(''' $1 ''', r''' [$]$1 ''')
16+
(''' $1 ''', r''' [$]$1 ''')
1717
AC_DIVERT_POP()dnl
1818
])])
1919

@@ -26,7 +26,7 @@ dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
2626
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
2727
define([AC_DEFINE],
2828
[cat >> confdefs.pytmp <<\EOF
29-
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
29+
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
3030
EOF
3131
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
3232
])
@@ -36,7 +36,7 @@ dnl python.
3636
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
3737
define([AC_DEFINE_UNQUOTED],
3838
[cat >> confdefs.pytmp <<EOF
39-
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
39+
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
4040
EOF
4141
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
4242
])
@@ -80,24 +80,19 @@ cat > $CONFIG_STATUS <<EOF
8080
#!${PYTHON}
8181
# coding=$encoding
8282
83-
import os, sys
83+
import os
8484
dnl topsrcdir is the top source directory in native form, as opposed to a
8585
dnl form suitable for make.
8686
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
8787
if not os.path.isabs(topsrcdir):
8888
topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
89-
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
90-
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
91-
from ConfigStatus import config_status
9289
93-
args = {
94-
'topsrcdir': topsrcdir,
95-
'topobjdir': os.path.dirname(<<<__file__>>>),
90+
topobjdir = os.path.dirname(<<<__file__>>>)
9691
9792
dnl All defines and substs are stored with an additional space at the beginning
9893
dnl and at the end of the string, to avoid any problem with values starting or
9994
dnl ending with quotes.
100-
'defines': [(name[1:-1], value[1:-1]) for name, value in [
95+
defines = [(name[1:-1], value[1:-1]) for name, value in [
10196
EOF
10297
10398
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
@@ -106,9 +101,9 @@ sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
106101
rm confdefs.pytmp confdefs.h
107102
108103
cat >> $CONFIG_STATUS <<\EOF
109-
] ],
104+
] ]
110105
111-
'substs': [(name[1:-1], value[1:-1]) for name, value in [
106+
substs = [(name[1:-1], value[1:-1]) for name, value in [
112107
EOF
113108
114109
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
@@ -118,51 +113,58 @@ undivert(MOZ_DIVERSION_SUBST)dnl
118113
EOF
119114
120115
cat >> $CONFIG_STATUS <<\EOF
121-
] ],
116+
] ]
122117
123118
dnl List of files to apply AC_SUBSTs to. This is the list of files given
124119
dnl as an argument to AC_OUTPUT ($1)
125-
'files': [
120+
files = [
126121
EOF
127122
128123
for out in $1; do
129-
echo " '$out'," >> $CONFIG_STATUS
124+
echo " '$out'," >> $CONFIG_STATUS
130125
done
131126
132127
cat >> $CONFIG_STATUS <<\EOF
133-
],
128+
]
134129
135130
dnl List of header files to apply AC_DEFINEs to. This is stored in the
136131
dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
137-
'headers': [
132+
headers = [
138133
EOF
139134
140135
ifdef(<<<AC_LIST_HEADER>>>, <<<
141136
HEADERS="AC_LIST_HEADER"
142137
for header in $HEADERS; do
143-
echo " '$header'," >> $CONFIG_STATUS
138+
echo " '$header'," >> $CONFIG_STATUS
144139
done
145140
>>>)dnl
146141
147142
cat >> $CONFIG_STATUS <<\EOF
148-
],
143+
]
149144
150145
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
151-
'non_global_defines': [
146+
non_global_defines = [
152147
EOF
153148
154149
if test -n "$_NON_GLOBAL_ACDEFINES"; then
155150
for var in $_NON_GLOBAL_ACDEFINES; do
156-
echo " '$var'," >> $CONFIG_STATUS
151+
echo " '$var'," >> $CONFIG_STATUS
157152
done
158153
fi
159154
160-
cat >> $CONFIG_STATUS <<\EOF
161-
]
162-
}
155+
cat >> $CONFIG_STATUS <<EOF
156+
]
157+
158+
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs', 'files', 'headers']
163159
164160
dnl Do the actual work
165-
config_status(**args)
161+
if __name__ == '__main__':
162+
args = dict([(name, globals()[name]) for name in __all__])
163+
import sys
164+
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
165+
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
166+
from ConfigStatus import config_status
167+
config_status(**args)
166168
EOF
167169
changequote([, ])
168170
chmod +x $CONFIG_STATUS

0 commit comments

Comments
 (0)