Skip to content

Commit

Permalink
python version agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
rhuanjl committed Jul 11, 2021
1 parent 312a878 commit 3c094de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bin/ch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
find_package (Python COMPONENTS Interpreter)
add_custom_target(dbg_controller_h
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jstoc.py ${CMAKE_CURRENT_SOURCE_DIR}/DbgController.js controllerScript
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/jstoc.py ${CMAKE_CURRENT_SOURCE_DIR}/DbgController.js controllerScript
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/jstoc.py ${CMAKE_CURRENT_SOURCE_DIR}/DbgController.js
)
Expand Down
9 changes: 5 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------
# Copyright (C) Microsoft. All rights reserved.
# Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
#-------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -127,7 +128,7 @@ CMAKE_EXPORT_COMPILE_COMMANDS="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
LIBS_ONLY_BUILD=
ALWAYS_YES=
CCACHE_NAME=
PYTHON2_BINARY=$(which python2.7 || which python2 || which python 2> /dev/null)
PYTHON_BINARY=$(which python3 || which python || which python2.7 || which python2 || which python 2> /dev/null)

UNAME_S=`uname -s`
if [[ $UNAME_S =~ 'Linux' ]]; then
Expand Down Expand Up @@ -538,7 +539,7 @@ export TARGET_PATH

if [[ $HAS_LTTNG == 1 ]]; then
CHAKRACORE_ROOT=`dirname $0`
"$PYTHON2_BINARY" $CHAKRACORE_ROOT/tools/lttng.py --man $CHAKRACORE_ROOT/manifests/Microsoft-Scripting-Chakra-Instrumentation.man --intermediate $TARGET_PATH/intermediate
"$PYTHON_BINARY" $CHAKRACORE_ROOT/tools/lttng.py --man $CHAKRACORE_ROOT/manifests/Microsoft-Scripting-Chakra-Instrumentation.man --intermediate $TARGET_PATH/intermediate
mkdir -p $TARGET_PATH/lttng
(diff -q $TARGET_PATH/intermediate/lttng/jscriptEtw.h $TARGET_PATH/lttng/jscriptEtw.h && echo "jscriptEtw.h up to date; skipping") || cp $TARGET_PATH/intermediate/lttng/* $TARGET_PATH/lttng/
fi
Expand All @@ -553,8 +554,8 @@ fi
BUILD_DIRECTORY="${TARGET_PATH}/${BUILD_TYPE_DIR:0}"
echo "Build path: ${BUILD_DIRECTORY}"

BUILD_RELATIVE_DIRECTORY=$("$PYTHON2_BINARY" -c "import os.path;print \
os.path.relpath('${CHAKRACORE_DIR}', '$BUILD_DIRECTORY')")
BUILD_RELATIVE_DIRECTORY=$("$PYTHON_BINARY" -c "from __future__ import print_function; import os.path;\
print(os.path.relpath('${CHAKRACORE_DIR}', '$BUILD_DIRECTORY'))")

################# Write-barrier check/analyze run #################
WB_FLAG=
Expand Down

0 comments on commit 3c094de

Please sign in to comment.