summarylogtreecommitdiffstats
path: root/force-python2.patch
blob: 94c0f21bede7788cb204541a06cf611bddbecc6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
diff --git a/bin/buckd b/bin/buckd
index 14a6c2e..0f4441f 100755
--- a/bin/buckd
+++ b/bin/buckd
@@ -9,4 +9,5 @@ while [ -h "$BUCK_PATH" ]; do
 done
 BUCK_DIR=$(dirname "$BUCK_PATH")
 
-PYTHONPATH="$BUCK_DIR"/../third-party/nailgun exec python "$BUCK_DIR"/../programs/buckd.py "$@"
+PYTHON=$(command -v python2 python | head -1)
+PYTHONPATH="$BUCK_DIR"/../third-party/nailgun exec $PYTHON "$BUCK_DIR"/../programs/buckd.py "$@"
diff --git a/build.xml b/build.xml
index 247747a..657b54f 100644
--- a/build.xml
+++ b/build.xml
@@ -207,7 +207,7 @@
   </target>
 
   <target name="python-get-prefix">
-    <exec executable="python" failonerror="true" outputproperty="python.prefix" logError="true">
+    <exec executable="python2" failonerror="true" outputproperty="python.prefix" logError="true">
       <arg value="-c" />
       <arg value="import distutils.sysconfig; print(distutils.sysconfig.PREFIX)" />
     </exec>
@@ -679,7 +679,7 @@
   <target name="py-test" description="runs the Python tests" depends="buck-py-test, class-loader-py-test, log-rotation-py-test, pathlib-py-test, zip-munger-py-test, buck-tool-py-test, scandir-py-test" />
 
   <target name="buck-py-test" description="tests the BUCK parser">
-    <exec executable="python" failonerror="true" dir="${basedir}/src/com/facebook/buck/json">
+    <exec executable="python2" failonerror="true" dir="${basedir}/src/com/facebook/buck/json">
       <!-- The py folder is actually a python package, so use module import style here. -->
       <env key="PYTHONPATH" path="${buck.pythonpath}" />
       <arg value="-m" />
@@ -690,21 +690,21 @@
   </target>
 
   <target name="class-loader-py-test" description="tests BUCK's class loader setup">
-      <exec executable="python" failonerror="true">
+      <exec executable="python2" failonerror="true">
           <env key="PYTHONPATH" path="${buck.pythonpath}" />
           <arg value="test/com/facebook/buck/cli/bootstrapper/class_loader_test.py" />
       </exec>
   </target>
 
   <target name="log-rotation-py-test" description="tests BUCK's logger setup">
-    <exec executable="python" failonerror="true">
+    <exec executable="python2" failonerror="true">
       <env key="PYTHONPATH" path="${buck.pythonpath}" />
       <arg value="test/com/facebook/buck/log/test_log_rotation.py" />
     </exec>
   </target>
 
   <target name="pathlib-py-test" description="tests pathlib.py">
-    <exec executable="python" failonerror="true" dir="${pathlib.dir}">
+    <exec executable="python2" failonerror="true" dir="${pathlib.dir}">
       <!-- Needed on Python 2.6. -->
       <env key="PYTHONPATH" path="${unittest2.dir}" />
       <arg value="test_pathlib.py" />
@@ -712,7 +712,7 @@
   </target>
 
   <target name="scandir-py-test" description="tests scandir.py">
-    <exec executable="python" failonerror="true" dir="${scandir.dir}/test">
+    <exec executable="python2" failonerror="true" dir="${scandir.dir}/test">
       <!-- Needed on Python 2.6. -->
       <env key="PYTHONPATH" path="${unittest2.dir}" />
       <arg value="run_tests.py" />
@@ -720,14 +720,14 @@
   </target>
 
   <target name="zip-munger-py-test" description="tests munger.py">
-    <exec executable="python" failonerror="true">
+    <exec executable="python2" failonerror="true">
       <env key="PYTHONPATH" path="${basedir}" />
       <arg value="py/buck/zip/test_munger.py" />
     </exec>
   </target>
 
   <target name="buck-tool-py-test" description="tests buck_tool.py">
-    <exec executable="python" failonerror="true">
+    <exec executable="python2" failonerror="true">
       <env key="PYTHONPATH" path="${buck.pythonpath}" />
       <arg value="programs/test_buck_tool.py" />
     </exec>
@@ -853,7 +853,7 @@
   </target>
 
   <target name="missing-test-files-check">
-    <exec dir="${user.dir}/scripts" executable="python" failonerror="true">
+    <exec dir="${user.dir}/scripts" executable="python2" failonerror="true">
       <arg line="verify-test-files.py" />
     </exec>
   </target>
diff --git a/docs/presentations/droidcon-nyc-2014/images/create_images.py b/docs/presentations/droidcon-nyc-2014/images/create_images.py
index cd6f6b9..27e02c5 100755
--- a/docs/presentations/droidcon-nyc-2014/images/create_images.py
+++ b/docs/presentations/droidcon-nyc-2014/images/create_images.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 """
 This exports a bunch of images from the base-dependency-diagram.graffle file
 using py-appscript:
diff --git a/docs/soy2html.py b/docs/soy2html.py
index ea55ed3..9bc7d31 100644
--- a/docs/soy2html.py
+++ b/docs/soy2html.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # This script is designed to be invoked by soy2html.sh.
 # Usage:
diff --git a/programs/buck.py b/programs/buck.py
index 33be17b..d1b8cea 100755
--- a/programs/buck.py
+++ b/programs/buck.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 from __future__ import print_function
 import os
 import signal
diff --git a/programs/buckd.py b/programs/buckd.py
index 8ef3d06..3458bbe 100755
--- a/programs/buckd.py
+++ b/programs/buckd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 from __future__ import print_function
 import os
 import sys
diff --git a/programs/timing.py b/programs/timing.py
index 60c1044..5def8ac 100644
--- a/programs/timing.py
+++ b/programs/timing.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import ctypes
 import platform
diff --git a/programs/tracing.py b/programs/tracing.py
index 6027013..02adbda 100644
--- a/programs/tracing.py
+++ b/programs/tracing.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import errno
 import glob
diff --git a/scripts/assert_code_coverage.py b/scripts/assert_code_coverage.py
index 8f6a772..3d68ab7 100644
--- a/scripts/assert_code_coverage.py
+++ b/scripts/assert_code_coverage.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import xml.etree.ElementTree as ElementTree
 import os
diff --git a/scripts/autofix_lint.py b/scripts/autofix_lint.py
index e7d5a62..ea127e3 100755
--- a/scripts/autofix_lint.py
+++ b/scripts/autofix_lint.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import argparse
 import re
diff --git a/scripts/intellij/generate_grammar_kit.py b/scripts/intellij/generate_grammar_kit.py
index afb908a..b49607b 100644
--- a/scripts/intellij/generate_grammar_kit.py
+++ b/scripts/intellij/generate_grammar_kit.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import subprocess
 import os
diff --git a/scripts/perf_test_hg.py b/scripts/perf_test_hg.py
index e7c8427..9c1502f 100755
--- a/scripts/perf_test_hg.py
+++ b/scripts/perf_test_hg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 """Performance test to make sure rule keys are unaffected by absolute paths.
 
 The general algorithm is:
diff --git a/scripts/verify-javadoc.py b/scripts/verify-javadoc.py
index 60cbbc2..ff74c3b 100755
--- a/scripts/verify-javadoc.py
+++ b/scripts/verify-javadoc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Examines the output from running Javadoc via Ant and checks to see if any
 # warnings were emitted. If so, fail the build unless the warning is in the
diff --git a/src/com/facebook/buck/apple/project_generator/build-with-buck.st b/src/com/facebook/buck/apple/project_generator/build-with-buck.st
index f596c6d..2ba6c7c 100644
--- a/src/com/facebook/buck/apple/project_generator/build-with-buck.st
+++ b/src/com/facebook/buck/apple/project_generator/build-with-buck.st
@@ -1,7 +1,7 @@
 set -e
 cd <repo_root>
 
-BUILD_WITH_BUCK_COMMAND=`python <path_to_build_with_buck_py> <repo_root> <path_to_buck> -- "<build_flags>" <escaped_build_target> <buck_dwarf_flavor> <buck_dsym_flavor>`
+BUILD_WITH_BUCK_COMMAND=`python2 <path_to_build_with_buck_py> <repo_root> <path_to_buck> -- "<build_flags>" <escaped_build_target> <buck_dwarf_flavor> <buck_dsym_flavor>`
 echo $BUILD_WITH_BUCK_COMMAND
 
 BUCK_BUNDLE_OUTPUT_PATH=`eval $BUILD_WITH_BUCK_COMMAND | awk 'NR>1 {print $2}'`
@@ -22,9 +22,9 @@ if [ "$DEBUG_INFORMATION_FORMAT" = "dwarf-with-dsym" ] || [ "<force_dsym>" == "t
     export LC_ALL=C
     sed -i '' 's|<comp_dir>|<padded_source_dir>|g' <resolved_dsym_destination>/Contents/Resources/DWARF/<binary_name>
 
-    python <path_to_fix_uuid_script> --verbose <resolved_bundle_destination> <resolved_dsym_destination> <binary_name>
+    python2 <path_to_fix_uuid_script> --verbose <resolved_bundle_destination> <resolved_dsym_destination> <binary_name>
 else
     echo "DWARF MODE"
     echo "Absolutifying object file paths in binary: $BUCK_BUNDLE_OUTPUT_PATH/<binary_name>"
     <path_to_buck> machoutils absolutify_object_paths --binary $BUCK_BUNDLE_OUTPUT_PATH/<binary_name> --output <resolved_bundle_destination>/<binary_name> --old_compdir "<comp_dir>" --new_compdir "<new_comp_dir>"
-fi
\ No newline at end of file
+fi
diff --git a/src/com/facebook/buck/python/make_pex.py b/src/com/facebook/buck/python/make_pex.py
index 0359eef..ff54c34 100755
--- a/src/com/facebook/buck/python/make_pex.py
+++ b/src/com/facebook/buck/python/make_pex.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 from __future__ import print_function
 import contextlib
diff --git a/test/com/facebook/buck/android/testdata/android_project/java/com/preprocess/convert.py b/test/com/facebook/buck/android/testdata/android_project/java/com/preprocess/convert.py
index 84276d4..15239c6 100755
--- a/test/com/facebook/buck/android/testdata/android_project/java/com/preprocess/convert.py
+++ b/test/com/facebook/buck/android/testdata/android_project/java/com/preprocess/convert.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 import sys
 import os
 import zipfile
diff --git a/test/com/facebook/buck/rage/testdata/interactive_report/extra.py b/test/com/facebook/buck/rage/testdata/interactive_report/extra.py
index f899a7e..69e4bc8 100755
--- a/test/com/facebook/buck/rage/testdata/interactive_report/extra.py
+++ b/test/com/facebook/buck/rage/testdata/interactive_report/extra.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 from __future__ import print_function
 import argparse
diff --git a/third-party/nailgun/pynailgun/ng.py b/third-party/nailgun/pynailgun/ng.py
index 577e868..49a0521 100755
--- a/third-party/nailgun/pynailgun/ng.py
+++ b/third-party/nailgun/pynailgun/ng.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Copyright 2004-2015, Martian Software, Inc.
 #
diff --git a/third-party/py/pywatchman/setup.py b/third-party/py/pywatchman/setup.py
index 243e83f..4c4d277 100755
--- a/third-party/py/pywatchman/setup.py
+++ b/third-party/py/pywatchman/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # vim:ts=4:sw=4:et:
 
 try:
diff --git a/third-party/py/pywatchman/tests/tests.py b/third-party/py/pywatchman/tests/tests.py
index 02d9a0b..92492e9 100755
--- a/third-party/py/pywatchman/tests/tests.py
+++ b/third-party/py/pywatchman/tests/tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # vim:ts=4:sw=4:et:
 from __future__ import absolute_import
 from __future__ import division