Skip to content

Commit

Permalink
Fixed crash in linux for set_script in Object. Added monthly linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
niklas2902 committed Sep 29, 2024
1 parent 43e43a3 commit b698343
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 5 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/monthly-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: monthly linux
on:
workflow_dispatch:
schedule:
- cron: '0 3 1 * *' # run at 3 AM UTC on the 1st day of every month

jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{ github.sha }}

- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"

linux-build:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}

runs-on: ubuntu-latest
strategy:
matrix:
include:
- PLATFORM: 'linux64'
PYTHON_ARCH: 'x64'
VS_ARCH: 'amd64'

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11.3
uses: actions/setup-python@v2
with:
python-version: "3.11.3"

- name: Install Mesa
run: |
sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update
sudo apt upgrade
sudo apt-get install xvfb
- name: print structure
run: |
python3 meson_scripts/print_tools.py
- name: Install dependencies
run: |
python3 -m pip install -r requirements.txt
python3 -m pip install flake8
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Install docker
run: |
python3 -m pip install docker
- name: Init submodule
run: |
git submodule init
git submodule update
-name: Cythonize
run: |
python3 cythonize_files.py
- name: build
run: |
python3 create_plugin.py
- name: Upload build output as an artifact
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: ./plugin

- name: print structure
run: |
python3 meson_scripts/print_tools.py
12 changes: 7 additions & 5 deletions generation_files/generate_classes_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def generate_args_for_call(method_with_args, is_cpp=False):

for arg in method_with_args["arguments"]:
if arg["type"] == "Variant":
result += f"variant_{pythonize_name(arg['name'])}, "
result += f"*variant_{pythonize_name(arg['name'])}, "
else:
result += f"{unref_pointer(pythonize_name(arg['type']), pythonize_name(arg['name']))}, "
result = result[:-2]
Expand All @@ -775,11 +775,11 @@ def generate_variants(method):
return result
for arg in method["arguments"]:
if arg["type"] == "Variant":
result += f"{INDENT*2}Variant variant_{pythonize_name(arg['name'])};"
result += f"{INDENT*2}Variant* variant_{pythonize_name(arg['name'])} = new Variant(1);"
result = generate_newline(result)
result += f"{INDENT*2}std::string type_name_{pythonize_name(arg['name'])} = get_python_typename({pythonize_name(arg['name'])});"
result = generate_newline(result)
result += f"{INDENT*2}variant_{pythonize_name(arg['name'])}.init_from_py_object_native_ptr({pythonize_name(arg['name'])}, type_name_{pythonize_name(arg['name'])}.c_str());"
result += f"{INDENT*2}variant_{pythonize_name(arg['name'])}->init_from_py_object_native_ptr({pythonize_name(arg['name'])}, type_name_{pythonize_name(arg['name'])}.c_str());"
result = generate_newline(result)
return result
def generate_py_method_body(class_, method):
Expand Down Expand Up @@ -824,9 +824,11 @@ def free_variants(mMethod):
return res
for argument in mMethod["arguments"]:
if argument["type"] == "Variant":
res += f"{INDENT * 2}if (functions::get_variant_get_type()(&variant_{pythonize_name(argument['name'])}.native_ptr) != GDEXTENSION_VARIANT_TYPE_OBJECT){{"
res += f"{INDENT * 2}if (functions::get_variant_get_type()(&variant_{pythonize_name(argument['name'])}->native_ptr) != GDEXTENSION_VARIANT_TYPE_OBJECT){{"
res = generate_newline(res)
res += f"{INDENT * 3}functions::get_variant_destroy()(&variant_{pythonize_name(argument['name'])}.native_ptr);"
res += f"{INDENT * 3}functions::get_variant_destroy()(&variant_{pythonize_name(argument['name'])}->native_ptr);"
res = generate_newline(res)
res += f"{INDENT * 3}free(variant_{pythonize_name(argument['name'])});"
res = generate_newline(res)
res += f"{INDENT*3}Py_DECREF({pythonize_name(argument['name'])});"
res +=f"{INDENT*2}}}"
Expand Down

0 comments on commit b698343

Please sign in to comment.