From 035886b6551199cb2fc709791823247b268f891f Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 23 Feb 2024 01:34:24 +0800 Subject: [PATCH] use `python` instead of `python3` --- .github/workflows/main.yml | 29 +++++++++++++++-------------- build.sh | 10 +--------- build_web.sh | 2 +- run_profile.sh | 2 +- run_tests.sh | 5 ++--- scripts/run_tests.py | 2 +- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af788884..07f10b61 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: - name: Compile shell: powershell run: | - python3 amalgamate.py + python amalgamate.py cd amalgamated cl.exe /std:c++17 /EHsc /utf-8 /O2 /I. /DPK_ENABLE_OS=1 main.cpp /link /out:pkpy.exe - uses: actions/upload-artifact@v3 @@ -34,16 +34,16 @@ jobs: shell: bash run: | mkdir -p output/windows/x86_64 - python3 cmake_build.py + python cmake_build.py cp main.exe output/windows/x86_64 cp pocketpy.dll output/windows/x86_64 - uses: actions/upload-artifact@v3 with: path: output - name: Unit Test - run: python3 scripts/run_tests.py + run: python scripts/run_tests.py - name: Benchmark - run: python3 scripts/run_tests.py benchmark + run: python scripts/run_tests.py benchmark build_linux: runs-on: ubuntu-20.04 steps: @@ -66,7 +66,7 @@ jobs: - name: Compile run: | mkdir -p output/linux/x86_64 - python3 cmake_build.py + python cmake_build.py cp main output/linux/x86_64 cp libpocketpy.so output/linux/x86_64 env: @@ -76,7 +76,7 @@ jobs: with: path: output - name: Benchmark - run: python3 scripts/run_tests.py benchmark + run: python scripts/run_tests.py benchmark - name: C Binding Test run: bash run_c_binding_test.sh build_linux_x86: @@ -91,23 +91,24 @@ jobs: branch: v3.15 - name: Build and Test run: | + ln -s /usr/bin/python3 /usr/bin/python uname -m - python3 cmake_build.py - python3 scripts/run_tests.py - python3 scripts/run_tests.py benchmark - shell: alpine.sh {0} + python cmake_build.py + python scripts/run_tests.py + python scripts/run_tests.py benchmark + shell: alpine.sh --root {0} build_darwin: runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Compile and Test run: | - python3 cmake_build.py - python3 scripts/run_tests.py + python cmake_build.py + python scripts/run_tests.py - name: Benchmark - run: python3 scripts/run_tests.py benchmark + run: python scripts/run_tests.py benchmark - run: | - python3 amalgamate.py + python amalgamate.py cd plugins/macos/pocketpy mkdir -p output/macos xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO diff --git a/build.sh b/build.sh index c72d5a32..c9309202 100644 --- a/build.sh +++ b/build.sh @@ -1,12 +1,5 @@ #!/bin/bash -# Check if python3 is installed -if ! type -P python3 >/dev/null 2>&1; then - echo "python3 is required and not installed. Kindly install it." - echo "Run: sudo apt install python3" - exit 1 -fi - # Check if clang++ is installed if ! type -P clang++ >/dev/null 2>&1; then echo "clang++ is required and not installed. Kindly install it." @@ -14,12 +7,11 @@ if ! type -P clang++ >/dev/null 2>&1; then exit 1 fi -echo "Requirements satisfied: python3 and clang are installed." echo "It takes a moment to finish building." echo "" echo "> Running prebuild.py... " -python3 prebuild.py +python prebuild.py if [ $? -ne 0 ]; then echo "prebuild.py failed." diff --git a/build_web.sh b/build_web.sh index fb69a174..b6cc1929 100644 --- a/build_web.sh +++ b/build_web.sh @@ -1,4 +1,4 @@ -python3 prebuild.py +python prebuild.py rm -rf web/lib mkdir web/lib diff --git a/run_profile.sh b/run_profile.sh index b06d24a2..c3ad3af2 100644 --- a/run_profile.sh +++ b/run_profile.sh @@ -1,4 +1,4 @@ -python3 prebuild.py +python prebuild.py SRC=$(find src/ -name "*.cpp") clang++ -pg -O1 -std=c++17 -stdlib=libc++ -Wfatal-errors -o main $SRC src2/main.cpp -Iinclude time ./main benchmarks/fib.py diff --git a/run_tests.sh b/run_tests.sh index 6b28f489..86a7b875 100644 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,9 +1,8 @@ -python3 prebuild.py +python prebuild.py SRC=$(find src/ -name "*.cpp") clang++ -std=c++17 --coverage -O1 -stdlib=libc++ -Wfatal-errors -o main src2/main.cpp $SRC -Iinclude -DPK_ENABLE_OS=1 -python3 scripts/run_tests.py -# python3 scripts/run_tests.py benchmarks/ +python scripts/run_tests.py # if prev error exit if [ $? -ne 0 ]; then diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 20732c6d..7eb8446c 100644 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -18,7 +18,7 @@ def test_file(filepath, cpython=False): if cpython: x, y = os.path.split(filepath) with WorkDir(x): - return os.system("python3 " + y) == 0 + return os.system("python " + y) == 0 if sys.platform == 'win32': return os.system("main.exe " + filepath) == 0 else: