From eb8712ea87a42e40f62a0e3f774bee78497bdbfd Mon Sep 17 00:00:00 2001
From: David Braun <2096055+DBraun@users.noreply.github.com>
Date: Fri, 5 Apr 2024 08:35:39 -0400
Subject: [PATCH] try to fix codesign

---
 .github/workflows/all.yml | 2 ++
 build_tdfaust.py          | 3 ---
 faust2td.py               | 4 ----
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml
index 936ec9c..e19a6ce 100644
--- a/.github/workflows/all.yml
+++ b/.github/workflows/all.yml
@@ -149,11 +149,13 @@ jobs:
       run: |
         export PATH=$pythonLocation:$PATH
         python build_tdfaust.py --pythonver=3.11 --arch=${{matrix.arch}}
+        codesign --force --verify --verbose=2 --timestamp --options=runtime --deep --sign "Developer ID Application: David Braun (${{secrets.CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}})" build/Release/TD-Faust.plugin
 
     - name: Build Reverb operator
       run: |
         export PATH=$PWD/thirdparty/libfaust/darwin-x64/Release/bin:$PATH
         python faust2td.py --dsp reverb.dsp --type "Reverb" --label "Reverb" --icon "Rev" --author "David Braun" --email "github.com/DBraun" --drop-prefix --arch=${{matrix.arch}}
+        codesign --force --verify --verbose=2 --timestamp --options=runtime --deep --sign "Developer ID Application: David Braun (${{secrets.CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM}})" {file_dest}'
 
     - name: Make distribution
       run: |
diff --git a/build_tdfaust.py b/build_tdfaust.py
index e3fa318..88c114a 100644
--- a/build_tdfaust.py
+++ b/build_tdfaust.py
@@ -66,9 +66,6 @@ def build_macos(pythonver: str, touchdesigner_app: str, arch: str=None):
     run_command(cmake_command)
     run_command(["cmake", "--build", "build", "--config", "Release"])
     os.system('mv build/Release/TD-Faust.plugin Plugins')
-    if 'CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM' in os.environ:
-        CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM = os.environ['CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM']
-        subprocess.call(shlex.split(f'codesign --force --verify --verbose=2 --timestamp --options=runtime --deep --sign "Developer ID Application: David Braun ({CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM})" build/Release/TD-Faust.plugin'))
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description="Build TD-Faust plugin for Windows or macOS.")
diff --git a/faust2td.py b/faust2td.py
index 1c5b787..fc4bf64 100644
--- a/faust2td.py
+++ b/faust2td.py
@@ -307,9 +307,5 @@ def add_toggle(item) -> str:
     if platform.system() == 'Darwin':
         file_dest = f'"{build_dir}/Release/{op_type}.plugin"'
         subprocess.call(shlex.split(f'cp -r {file_dest} Plugins'))
-        if 'CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM' in os.environ:
-            CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM = os.environ['CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM']
-            subprocess.call(shlex.split(f'codesign --force --verify --verbose=2 --timestamp --options=runtime --deep --sign "Developer ID Application: David Braun ({CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM})" {file_dest}'))
-
 
     print('All done!')