Skip to content
Merged
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
34 changes: 18 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ env:
BUILD_TYPE: Release

jobs:
#
# Windows
#
# __
# |\__/ \
# | |
# | __ |
# \__/ \|
#
#
maya-win:
runs-on: windows-2019

Expand Down Expand Up @@ -75,7 +65,7 @@ jobs:
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: windows-${{matrix.maya}}
name: win64-${{matrix.maya}}
path: |
artifacts/plug-ins/simplex_maya.mll
artifacts/pyModules/py*simplex.pyd
Expand Down Expand Up @@ -256,9 +246,6 @@ jobs:
needs: [maya-win, maya-linux, maya-macos-11, maya-macos-12]
runs-on: ubuntu-latest

# Only run on e.g. v0.1.0
if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -282,17 +269,32 @@ jobs:
with:
path: modules/simplex

- name: Build Modfile
run: |
python buildmodfile.py modules/simplex.mod --name simplex --path modules/simplex

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Create distribution
run: |
cp ./simplex.mod modules/
mkdir -p modules/simplex/scripts
cp -r ./scripts/simplexui modules/simplex/scripts
zip -r simplex-${{env.RELEASE_VERSION}}.zip modules/
zip -r simplex.zip modules/

- name: Upload Artifacts
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v3
with:
name: simplex-module
path: simplex.zip

- name: Rename Zip
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: mv simplex.zip simplex-${{env.RELEASE_VERSION}}.zip

- name: Upload distribution
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
78 changes: 78 additions & 0 deletions buildmodfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import os
import re
import argparse
from pathlib import Path, PurePosixPath


def list_files(startpath, skips=None):
print("ROOT: ", startpath)
for root, dirs, files in os.walk(startpath):
hidden = [i for i, d in enumerate(dirs) if d[0] == "."]
if skips is not None:
hidden += [i for i, d in enumerate(dirs) if d in skips]

for i in sorted(hidden, reverse=True):
dirs.pop(i)

base = os.path.basename(root)
level = root.replace(startpath, "").count(os.sep)
indent = " " * 4 * (level)
print("{}{}/".format(indent, base))
subindent = " " * 4 * (level + 1)
for f in files:
if f[0] != ".":
print("{}{}".format(subindent, f))


def main(outpath, modname, modver, modpath):
outpath = Path(outpath).absolute()

basepath = outpath.parent
modpath = Path(modpath).absolute()
modrel = modpath.relative_to(basepath)

plugPaths = sorted(list(modpath.glob(str(Path("**") / "plug-ins"))))
print("FOUND PLUGINS")
print(plugPaths)

lines = []
for pp in plugPaths:
rel = PurePosixPath(pp.relative_to(modpath))
match = re.search(r"(?P<platform>win64|linux|mac)-(?P<year>\d+)", str(rel))
if not match:
continue
plat, year = match["platform"], match["year"]
lines.append(
f"+ PLATFORM:{plat} MAYAVERSION:{year} {modname} {modver} {modrel}"
)
lines.append(f"plug-ins: {rel}")
lines.append("")

if not os.path.isdir(basepath):
os.makedirs(basepath)
print("Writing modfile to:")
print(outpath)
print("With Contents:")
print("\n".join(lines))

with open(outpath, "w") as f:
f.write("\n".join(lines))


def parse():
parser = argparse.ArgumentParser(
prog="buildmodfile",
description="builds a mod file ensuring that plugins are loaded for the proper maya versions",
)
parser.add_argument("outpath", help="The output filepath")
parser.add_argument("-n", "--name", help="The name of the module", required=True)
parser.add_argument("-v", "--version", help="The version of the module", default="1.0.0")
parser.add_argument("-p", "--path", help="The path to the module folder", required=True)
args = parser.parse_args()

list_files(os.getcwd(), skips=['eigen', 'rapidjson', 'os'])
main(args.outpath, args.name, args.version, args.path)


if __name__ == "__main__":
parse()
59 changes: 0 additions & 59 deletions simplex.mod

This file was deleted.