Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile for Python 3.10 for Blender 3.1 #341

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/scripts/setup_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
import shutil
import platform
import sys


TMP_DIRPATH = r"./tmp"
Expand All @@ -14,7 +15,8 @@
def setup_addon_directory():
plateform_name = "windows" if platform.system() == "Windows" else "linux" if platform.system() == "Linux" else "macOS"
version = read_version()
addon_dirpath = os.path.join(TMP_DIRPATH, f"modular_tree_{version}_{plateform_name}")
blender_version_suffix = get_blender_version_suffix()
addon_dirpath = os.path.join(TMP_DIRPATH, f"modular_tree_{version}_{plateform_name}{blender_version_suffix}")
root = os.path.join(addon_dirpath, "modular_tree")
Path(root).mkdir(exist_ok=True, parents=True)

Expand Down Expand Up @@ -61,6 +63,9 @@ def read_version():
with open(VERSION_FILEPATH, "r") as f:
return f.read()

def get_blender_version_suffix():
return "_blender31" if sys.version_info >= (3, 10) else "_blender293-30"

if __name__ == "__main__":
addon_dirpath = setup_addon_directory()
archive_filepath = create_zip(addon_dirpath, TMP_DIRPATH)
25 changes: 20 additions & 5 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,28 @@ jobs:
include:
- os: windows-latest
extension: bat
name: windows
name: windows-blender293
python: 3.9
- os: ubuntu-latest
extension: sh
name: linux
name: linux-blender293
python: 3.9
- os: macos-latest
extension: osx
name: macOS
name: macOS-blender293
python: 3.9
- os: windows-latest
extension: bat
name: windows-blender31
python: 3.9
- os: ubuntu-latest
extension: sh
name: linux-blender31
python: 3.9
- os: macos-latest
extension: osx
name: macOS-blender31
python: 3.9
runs-on: ${{ matrix.os }}
steps:
- name: checkout
Expand All @@ -23,7 +38,7 @@ jobs:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: ${{ matrix.python }}
- name: build
run: ./build_mtree.${{ matrix.extension }}
- name: package addon
Expand Down Expand Up @@ -53,7 +68,7 @@ jobs:
uses: johnwbyrd/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: ./modular_tree_windows/modular_tree_${{ steps.vars.outputs.version }}_windows.zip ./modular_tree_linux/modular_tree_${{ steps.vars.outputs.version }}_linux.zip ./modular_tree_macOS/modular_tree_${{ steps.vars.outputs.version }}_macOS.zip
files: ./modular_tree_windows-blender293/modular_tree_${{ steps.vars.outputs.version }}_windows_blender293-30.zip ./modular_tree_windows-blender31/modular_tree_${{ steps.vars.outputs.version }}_windows_blender31.zip ./modular_tree_linux-blender293/modular_tree_${{ steps.vars.outputs.version }}_linux_blender293-30.zip ./modular_tree_linux-blender31/modular_tree_${{ steps.vars.outputs.version }}_linux_blender31.zip ./modular_tree_macOS-blender293/modular_tree_${{ steps.vars.outputs.version }}_macOS_blender293-30.zip ./modular_tree_macOS-blender31/modular_tree_${{ steps.vars.outputs.version }}_macOS_blender31.zip
release: Release V${{ steps.vars.outputs.version }}${{ env.STATUS }}
tag: ${{ steps.vars.outputs.version }}${{ env.STATUS }}
message: V${{ steps.vars.outputs.version }}
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"name" : "Modular Tree",
"author" : "Maxime",
"description" : "create trees",
"blender" : (2, 83, 0),
"blender" : (2, 93, 0),
"version" : (4, 0, 2),
"location" : "",
"warning" : "",
Expand Down
4 changes: 2 additions & 2 deletions build_mtree.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
py -3.9 m_tree/install.py
py -3.10 m_tree/install.py

COPY ".\m_tree\binaries\Release\m_tree.cp39-win_amd64.pyd" "./m_tree.cp39-win_amd64.pyd"
COPY ".\m_tree\binaries\Release\m_tree.cp310-win_amd64.pyd" "./m_tree.cp310-win_amd64.pyd"

PAUSE

Expand Down
2 changes: 1 addition & 1 deletion build_mtree.osx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python3 m_tree/install.py
cp ./m_tree/binaries/m_tree.cpython-39-darwin.so ./m_tree.cpython-39-darwin.so
cp ./m_tree/binaries/m_tree.cpython-310-darwin.so ./m_tree.cpython-310-darwin.so



2 changes: 1 addition & 1 deletion build_mtree.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python3 m_tree/install.py
cp ./m_tree/binaries/m_tree.cpython-39-x86_64-linux-gnu.so ./m_tree.cpython-39-x86_64-linux-gnu.so
cp ./m_tree/binaries/m_tree.cpython-310-x86_64-linux-gnu.so ./m_tree.cpython-310-x86_64-linux-gnu.so



2 changes: 1 addition & 1 deletion m_tree/dependencies/pybind11
Submodule pybind11 updated 208 files
2 changes: 1 addition & 1 deletion m_tree/dependencies/vcpkg
Submodule vcpkg updated 7069 files
2 changes: 1 addition & 1 deletion m_tree/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def build():
if not os.path.exists(build_dir):
os.makedirs(build_dir)

subprocess.check_call(['cmake', "../", "-DPYBIND11_PYTHON_VERSION=3.9"], cwd=build_dir)
subprocess.check_call(['cmake', "../", "-DPYBIND11_PYTHON_VERSION=3.10"], cwd=build_dir)
subprocess.check_call(['cmake', '--build', '.', "--config", "Release"], cwd=build_dir)

print([i for i in os.listdir(os.path.join(os.path.dirname(__file__), "binaries"))])
Expand Down