Răsfoiți Sursa

use `python` instead of `python3`

blueloveTH 2 ani în urmă
părinte
comite
035886b655
6 a modificat fișierele cu 21 adăugiri și 29 ștergeri
  1. 15 14
      .github/workflows/main.yml
  2. 1 9
      build.sh
  3. 1 1
      build_web.sh
  4. 1 1
      run_profile.sh
  5. 2 3
      run_tests.sh
  6. 1 1
      scripts/run_tests.py

+ 15 - 14
.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

+ 1 - 9
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."

+ 1 - 1
build_web.sh

@@ -1,4 +1,4 @@
-python3 prebuild.py
+python prebuild.py
 
 rm -rf web/lib
 mkdir web/lib

+ 1 - 1
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

+ 2 - 3
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

+ 1 - 1
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: