use python instead of python3

This commit is contained in:
blueloveTH 2024-02-23 01:34:24 +08:00
parent 0599130c0d
commit 035886b655
6 changed files with 21 additions and 29 deletions

View File

@ -19,7 +19,7 @@ jobs:
- name: Compile - name: Compile
shell: powershell shell: powershell
run: | run: |
python3 amalgamate.py python amalgamate.py
cd amalgamated cd amalgamated
cl.exe /std:c++17 /EHsc /utf-8 /O2 /I. /DPK_ENABLE_OS=1 main.cpp /link /out:pkpy.exe 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 - uses: actions/upload-artifact@v3
@ -34,16 +34,16 @@ jobs:
shell: bash shell: bash
run: | run: |
mkdir -p output/windows/x86_64 mkdir -p output/windows/x86_64
python3 cmake_build.py python cmake_build.py
cp main.exe output/windows/x86_64 cp main.exe output/windows/x86_64
cp pocketpy.dll output/windows/x86_64 cp pocketpy.dll output/windows/x86_64
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
path: output path: output
- name: Unit Test - name: Unit Test
run: python3 scripts/run_tests.py run: python scripts/run_tests.py
- name: Benchmark - name: Benchmark
run: python3 scripts/run_tests.py benchmark run: python scripts/run_tests.py benchmark
build_linux: build_linux:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -66,7 +66,7 @@ jobs:
- name: Compile - name: Compile
run: | run: |
mkdir -p output/linux/x86_64 mkdir -p output/linux/x86_64
python3 cmake_build.py python cmake_build.py
cp main output/linux/x86_64 cp main output/linux/x86_64
cp libpocketpy.so output/linux/x86_64 cp libpocketpy.so output/linux/x86_64
env: env:
@ -76,7 +76,7 @@ jobs:
with: with:
path: output path: output
- name: Benchmark - name: Benchmark
run: python3 scripts/run_tests.py benchmark run: python scripts/run_tests.py benchmark
- name: C Binding Test - name: C Binding Test
run: bash run_c_binding_test.sh run: bash run_c_binding_test.sh
build_linux_x86: build_linux_x86:
@ -91,23 +91,24 @@ jobs:
branch: v3.15 branch: v3.15
- name: Build and Test - name: Build and Test
run: | run: |
ln -s /usr/bin/python3 /usr/bin/python
uname -m uname -m
python3 cmake_build.py python cmake_build.py
python3 scripts/run_tests.py python scripts/run_tests.py
python3 scripts/run_tests.py benchmark python scripts/run_tests.py benchmark
shell: alpine.sh {0} shell: alpine.sh --root {0}
build_darwin: build_darwin:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Compile and Test - name: Compile and Test
run: | run: |
python3 cmake_build.py python cmake_build.py
python3 scripts/run_tests.py python scripts/run_tests.py
- name: Benchmark - name: Benchmark
run: python3 scripts/run_tests.py benchmark run: python scripts/run_tests.py benchmark
- run: | - run: |
python3 amalgamate.py python amalgamate.py
cd plugins/macos/pocketpy cd plugins/macos/pocketpy
mkdir -p output/macos mkdir -p output/macos
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

View File

@ -1,12 +1,5 @@
#!/bin/bash #!/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 # Check if clang++ is installed
if ! type -P clang++ >/dev/null 2>&1; then if ! type -P clang++ >/dev/null 2>&1; then
echo "clang++ is required and not installed. Kindly install it." 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 exit 1
fi fi
echo "Requirements satisfied: python3 and clang are installed."
echo "It takes a moment to finish building." echo "It takes a moment to finish building."
echo "" echo ""
echo "> Running prebuild.py... " echo "> Running prebuild.py... "
python3 prebuild.py python prebuild.py
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "prebuild.py failed." echo "prebuild.py failed."

View File

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

View File

@ -1,4 +1,4 @@
python3 prebuild.py python prebuild.py
SRC=$(find src/ -name "*.cpp") SRC=$(find src/ -name "*.cpp")
clang++ -pg -O1 -std=c++17 -stdlib=libc++ -Wfatal-errors -o main $SRC src2/main.cpp -Iinclude clang++ -pg -O1 -std=c++17 -stdlib=libc++ -Wfatal-errors -o main $SRC src2/main.cpp -Iinclude
time ./main benchmarks/fib.py time ./main benchmarks/fib.py

View File

@ -1,9 +1,8 @@
python3 prebuild.py python prebuild.py
SRC=$(find src/ -name "*.cpp") 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 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 python scripts/run_tests.py
# python3 scripts/run_tests.py benchmarks/
# if prev error exit # if prev error exit
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then

View File

@ -18,7 +18,7 @@ def test_file(filepath, cpython=False):
if cpython: if cpython:
x, y = os.path.split(filepath) x, y = os.path.split(filepath)
with WorkDir(x): with WorkDir(x):
return os.system("python3 " + y) == 0 return os.system("python " + y) == 0
if sys.platform == 'win32': if sys.platform == 'win32':
return os.system("main.exe " + filepath) == 0 return os.system("main.exe " + filepath) == 0
else: else: