mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
...
This commit is contained in:
parent
c89a74db1e
commit
75a7a80630
236
.github/workflows/main.yml
vendored
236
.github/workflows/main.yml
vendored
@ -1,118 +1,118 @@
|
|||||||
# name: build
|
name: build
|
||||||
# on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
# jobs:
|
jobs:
|
||||||
# build_win:
|
build_win:
|
||||||
# runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
# steps:
|
steps:
|
||||||
# - uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
# - uses: ilammy/msvc-dev-cmd@v1
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
# - name: Compile
|
- name: Compile
|
||||||
# shell: bash
|
shell: bash
|
||||||
# run: |
|
run: |
|
||||||
# python3 build.py windows
|
python3 build.py windows
|
||||||
# python3 build.py windows -lib
|
python3 build.py windows -lib
|
||||||
# mkdir -p output/windows/x86_64
|
mkdir -p output/windows/x86_64
|
||||||
# cp pocketpy.exe output/windows/x86_64
|
cp pocketpy.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: python3 scripts/run_tests.py
|
||||||
# - name: Benchmark
|
- name: Benchmark
|
||||||
# run: python3 scripts/run_tests.py benchmark
|
run: python3 scripts/run_tests.py benchmark
|
||||||
# build_linux:
|
build_linux:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# steps:
|
steps:
|
||||||
# - uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
# - name: Setup Clang
|
- name: Setup Clang
|
||||||
# uses: egor-tensin/setup-clang@v1
|
uses: egor-tensin/setup-clang@v1
|
||||||
# with:
|
with:
|
||||||
# version: 15
|
version: 15
|
||||||
# platform: x64
|
platform: x64
|
||||||
# - name: Install libc++
|
- name: Install libc++
|
||||||
# run: sudo apt install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15
|
run: sudo apt install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15
|
||||||
# - name: Compile
|
- name: Compile
|
||||||
# run: |
|
run: |
|
||||||
# python3 build.py linux
|
python3 build.py linux
|
||||||
# python3 build.py linux -lib
|
python3 build.py linux -lib
|
||||||
# mkdir -p output/linux/x86_64
|
mkdir -p output/linux/x86_64
|
||||||
# cp pocketpy output/linux/x86_64
|
cp pocketpy output/linux/x86_64
|
||||||
# cp pocketpy.so output/linux/x86_64
|
cp pocketpy.so output/linux/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: python3 scripts/run_tests.py
|
||||||
# - name: Benchmark
|
- name: Benchmark
|
||||||
# run: python3 scripts/run_tests.py benchmark
|
run: python3 scripts/run_tests.py benchmark
|
||||||
# build_macos:
|
build_macos:
|
||||||
# runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
# steps:
|
steps:
|
||||||
# - uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
# - run: |
|
- run: |
|
||||||
# python3 amalgamate.py
|
python3 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
|
||||||
# cp -r build/Release/pocketpy.bundle output/macos
|
cp -r build/Release/pocketpy.bundle output/macos
|
||||||
# - uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
# with:
|
with:
|
||||||
# path: plugins/macos/pocketpy/output
|
path: plugins/macos/pocketpy/output
|
||||||
# build_android:
|
build_android:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# steps:
|
steps:
|
||||||
# - uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
# - uses: subosito/flutter-action@v2
|
- uses: subosito/flutter-action@v2
|
||||||
# with:
|
with:
|
||||||
# flutter-version: '3.3.0'
|
flutter-version: '3.3.0'
|
||||||
# channel: 'stable'
|
channel: 'stable'
|
||||||
# cache: true
|
cache: true
|
||||||
# - run: flutter --version
|
- run: flutter --version
|
||||||
# - name: Compile
|
- name: Compile
|
||||||
# run: |
|
run: |
|
||||||
# python3 amalgamate.py
|
python3 amalgamate.py
|
||||||
# cd plugins/flutter/example
|
cd plugins/flutter/example
|
||||||
# flutter build apk --split-debug-info=.debug-info --split-per-abi
|
flutter build apk --split-debug-info=.debug-info --split-per-abi
|
||||||
# cd build/app/outputs/flutter-apk
|
cd build/app/outputs/flutter-apk
|
||||||
# mkdir -p output/android/arm64-v8a
|
mkdir -p output/android/arm64-v8a
|
||||||
# mkdir -p output/android/armeabi-v7a
|
mkdir -p output/android/armeabi-v7a
|
||||||
# mkdir -p output/android/x86_64
|
mkdir -p output/android/x86_64
|
||||||
# unzip -q app-arm64-v8a-release.apk -d tmp
|
unzip -q app-arm64-v8a-release.apk -d tmp
|
||||||
# mv tmp/lib/arm64-v8a/libpocketpy.so output/android/arm64-v8a/libpocketpy.so
|
mv tmp/lib/arm64-v8a/libpocketpy.so output/android/arm64-v8a/libpocketpy.so
|
||||||
# rm -rf tmp
|
rm -rf tmp
|
||||||
# unzip -q app-armeabi-v7a-release.apk -d tmp
|
unzip -q app-armeabi-v7a-release.apk -d tmp
|
||||||
# mv tmp/lib/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a/libpocketpy.so
|
mv tmp/lib/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a/libpocketpy.so
|
||||||
# rm -rf tmp
|
rm -rf tmp
|
||||||
# unzip -q app-x86_64-release.apk -d tmp
|
unzip -q app-x86_64-release.apk -d tmp
|
||||||
# mv tmp/lib/x86_64/libpocketpy.so output/android/x86_64/libpocketpy.so
|
mv tmp/lib/x86_64/libpocketpy.so output/android/x86_64/libpocketpy.so
|
||||||
# rm -rf tmp
|
rm -rf tmp
|
||||||
# - uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
# with:
|
with:
|
||||||
# path: plugins/flutter/example/build/app/outputs/flutter-apk/output
|
path: plugins/flutter/example/build/app/outputs/flutter-apk/output
|
||||||
# build_web:
|
build_web:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# steps:
|
steps:
|
||||||
# - uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
# - name: Setup emsdk
|
- name: Setup emsdk
|
||||||
# uses: mymindstorm/setup-emsdk@v12
|
uses: mymindstorm/setup-emsdk@v12
|
||||||
# with:
|
with:
|
||||||
# version: 3.1.25
|
version: 3.1.25
|
||||||
# actions-cache-folder: 'emsdk-cache'
|
actions-cache-folder: 'emsdk-cache'
|
||||||
# - name: Verify emsdk
|
- name: Verify emsdk
|
||||||
# run: emcc -v
|
run: emcc -v
|
||||||
# - name: Compile
|
- name: Compile
|
||||||
# run: |
|
run: |
|
||||||
# mkdir -p output/web/lib
|
mkdir -p output/web/lib
|
||||||
# python3 build.py web
|
python3 build.py web
|
||||||
# cp web/lib/* output/web/lib
|
cp web/lib/* output/web/lib
|
||||||
# - uses: crazy-max/ghaction-github-pages@v3
|
- uses: crazy-max/ghaction-github-pages@v3
|
||||||
# with:
|
with:
|
||||||
# target_branch: gh-pages
|
target_branch: gh-pages
|
||||||
# build_dir: web
|
build_dir: web
|
||||||
# env:
|
env:
|
||||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
# - uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
# with:
|
with:
|
||||||
# path: output
|
path: output
|
@ -331,6 +331,7 @@ __NEXT_STEP:;
|
|||||||
TARGET(CONTAINS_OP)
|
TARGET(CONTAINS_OP)
|
||||||
// a in b -> b __contains__ a
|
// a in b -> b __contains__ a
|
||||||
_0 = call_method(TOP(), __contains__, SECOND());
|
_0 = call_method(TOP(), __contains__, SECOND());
|
||||||
|
POP();
|
||||||
if(byte.arg == 1){
|
if(byte.arg == 1){
|
||||||
TOP() = VAR(!CAST(bool, _0));
|
TOP() = VAR(!CAST(bool, _0));
|
||||||
}else{
|
}else{
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
// debug macros
|
// debug macros
|
||||||
#define DEBUG_NO_BUILTIN_MODULES 0
|
#define DEBUG_NO_BUILTIN_MODULES 0
|
||||||
#define DEBUG_EXTRA_CHECK 1
|
#define DEBUG_EXTRA_CHECK 0
|
||||||
#define DEBUG_DIS_EXEC 0
|
#define DEBUG_DIS_EXEC 0
|
||||||
#define DEBUG_CEVAL_STEP 0
|
#define DEBUG_CEVAL_STEP 0
|
||||||
#define DEBUG_CEVAL_STEP_MIN 0
|
#define DEBUG_CEVAL_STEP_MIN 0
|
||||||
|
@ -620,7 +620,7 @@ __SUBSCR_END:
|
|||||||
void compile_for_loop() {
|
void compile_for_loop() {
|
||||||
Expr_ vars = EXPR_VARS();
|
Expr_ vars = EXPR_VARS();
|
||||||
consume(TK("in"));
|
consume(TK("in"));
|
||||||
EXPR(false);
|
EXPR_TUPLE(false);
|
||||||
ctx()->emit(OP_GET_ITER, BC_NOARG, BC_KEEPLINE);
|
ctx()->emit(OP_GET_ITER, BC_NOARG, BC_KEEPLINE);
|
||||||
ctx()->enter_block(FOR_LOOP);
|
ctx()->enter_block(FOR_LOOP);
|
||||||
ctx()->emit(OP_FOR_ITER, BC_NOARG, BC_KEEPLINE);
|
ctx()->emit(OP_FOR_ITER, BC_NOARG, BC_KEEPLINE);
|
||||||
|
@ -10,4 +10,21 @@ assert x == 10
|
|||||||
|
|
||||||
a = [i for i in f(6)]
|
a = [i for i in f(6)]
|
||||||
|
|
||||||
assert a == [0,1,2,3,4,5]
|
assert a == [0,1,2,3,4,5]
|
||||||
|
|
||||||
|
def f(n):
|
||||||
|
for i in range(n):
|
||||||
|
for j in range(n):
|
||||||
|
yield i, j
|
||||||
|
|
||||||
|
a = [i for i in f(3)]
|
||||||
|
assert len(a) == 9
|
||||||
|
assert a[0] == (0,0)
|
||||||
|
assert a[1] == (0,1)
|
||||||
|
assert a[2] == (0,2)
|
||||||
|
assert a[3] == (1,0)
|
||||||
|
assert a[4] == (1,1)
|
||||||
|
assert a[5] == (1,2)
|
||||||
|
assert a[6] == (2,0)
|
||||||
|
assert a[7] == (2,1)
|
||||||
|
assert a[8] == (2,2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user