Reviewers: Michael Starzinger,

Message:
Makes the name of the python executable configurable, for systems where it's
called e.g. `python2.7` instead of just `python`.

Description:
build: make python executable configurable

Please review this at https://codereview.chromium.org/11418101/

Affected files:
  M Makefile
  M build/common.gypi
  M src/d8.gyp
  M test/cctest/cctest.gyp
  M tools/gyp/v8.gyp


Index: Makefile
diff --git a/Makefile b/Makefile
index b65ea4c9f949c9329dc0cc3b94e1267cd08d8df3..afc7ed1689d72e39ca3f5f7a24d14974c85b48d3 100644
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,7 @@
 CXX ?= g++
 LINK ?= g++
 OUTDIR ?= out
+PYTHON ?= python
 TESTJOBS ?=
 GYPFLAGS ?=
 TESTFLAGS ?=
@@ -116,6 +117,8 @@ ifeq ($(hardfp), on)
   GYPFLAGS += -Dv8_use_arm_eabi_hardfloat=true
 endif

+GYPFLAGS += "-Dpython=$(PYTHON)"
+
 # ----------------- available targets: --------------------
 # - "dependencies": pulls in external dependencies (currently: GYP)
 # - any arch listed in ARCHES (see below)
@@ -183,7 +186,7 @@ $(BUILDS): $(OUTDIR)/Makefile.$$(basename $$@)
        @$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \
                 CXX="$(CXX)" LINK="$(LINK)" \
                 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
-                            python -c "print raw_input().capitalize()") \
+                            $(PYTHON) -c "print raw_input().capitalize()") \
                 builddir="$(shell pwd)/$(OUTDIR)/$@"

 native: $(OUTDIR)/Makefile.native
@@ -254,14 +257,14 @@ clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean
 OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES))
 $(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE)
        GYP_GENERATORS=make \
-       build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
+       $(PYTHON) build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
                      -Ibuild/standalone.gypi --depth=. \
                      -Dv8_target_arch=$(subst .,,$(suffix $@)) \
                      -S.$(subst .,,$(suffix $@)) $(GYPFLAGS)

 $(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
        GYP_GENERATORS=make \
-       build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
+       $(PYTHON) build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
                      -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)

 must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN:
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index 46972c6763b1acf7b1bb41e69231f874191dd4f7..87fda5cfb0e355df425fe90e0f1d31fa8fba0eb8 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -102,6 +102,9 @@
     # Interpreted regexp engine exists as platform-independent alternative
     # based where the regular expression is compiled to a bytecode.
     'v8_interpreted_regexp%': 0,
+
+    # Name of the python executable.
+    'python%': 'python',
   },
   'target_defaults': {
     'conditions': [
Index: src/d8.gyp
diff --git a/src/d8.gyp b/src/d8.gyp
index a8361e6b4e5eca0cb83c791de8b44fbd85f3bceb..2aa94ccf92dd04c78be29f6240b4035fe1b2cb4e 100644
--- a/src/d8.gyp
+++ b/src/d8.gyp
@@ -99,7 +99,7 @@
             '<(SHARED_INTERMEDIATE_DIR)/d8-js.cc',
           ],
           'action': [
-            'python',
+            '<(python)',
             '../tools/js2c.py',
             '<@(_outputs)',
             'D8',
Index: test/cctest/cctest.gyp
diff --git a/test/cctest/cctest.gyp b/test/cctest/cctest.gyp
index 80eecfd0316f2e87d8590bfdbdd0cc03c0a95072..ed969f92aab19b15a037fd07decf73de9cda1b35 100644
--- a/test/cctest/cctest.gyp
+++ b/test/cctest/cctest.gyp
@@ -188,7 +188,7 @@
             '<(generated_file)',
           ],
           'action': [
-            'python',
+            '<(python)',
             '../../tools/js2c.py',
             '<@(_outputs)',
             'TEST',  # type
Index: tools/gyp/v8.gyp
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index aad07c70943bba0e3216b3a1f0fd71bc5b4d7ce4..5ca9725380a5f1d6706c42324a7a0ede0549b949 100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -802,7 +802,7 @@
                 '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
               ],
               'action': [
-                'python',
+                '<(python)',
                 '../../tools/js2c.py',
                 '<@(_outputs)',
                 'CORE',
@@ -820,7 +820,7 @@
                 '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
               ],
               'action': [
-                'python',
+                '<(python)',
                 '../../tools/js2c.py',
                 '<@(_outputs)',
                 'EXPERIMENTAL',
@@ -850,7 +850,7 @@
                   '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
                 ],
                 'action': [
-                  'python',
+                  '<(python)',
                   '../../tools/gen-postmortem-metadata.py',
                   '<@(_outputs)',
                   '<@(heapobject_files)'


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to