NeuralAmpModelerPlugin

Plugin for Neural Amp Modeler
Log | Files | Refs | Submodules | README | LICENSE

commit 6bf13beeb9ad482681f9b8f0983fb87f8aecc214
parent 8df0f4632e97213b73931789ebabbbaa58280b9c
Author: Steven Atkinson <steven@atkinson.mn>
Date:   Sun, 30 Apr 2023 20:14:51 -0700

Apply Black to Python code (#229)


Diffstat:
MNeuralAmpModeler/Colors.h | 6++++--
MNeuralAmpModeler/NeuralAmpModeler.cpp | 5+++--
MNeuralAmpModeler/scripts/makezip-win.py | 113++++++++++++++++++++++++++++++++++++++++++-------------------------------------
MNeuralAmpModeler/scripts/prepare_resources-ios.py | 56+++++++++++++++++++++++++++++++-------------------------
MNeuralAmpModeler/scripts/prepare_resources-mac.py | 64+++++++++++++++++++++++++++++++++++++---------------------------
MNeuralAmpModeler/scripts/prepare_resources-win.py | 110++++++++++++++++++++++++++++++++++++++++---------------------------------------
MNeuralAmpModeler/scripts/update_installer-win.py | 109+++++++++++++++++++++++++++++++++++++++++--------------------------------------
MNeuralAmpModeler/scripts/update_version-ios.py | 231+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
MNeuralAmpModeler/scripts/update_version-mac.py | 445+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
MTemplateProject/scripts/makezip-win.py | 113++++++++++++++++++++++++++++++++++++++++++-------------------------------------
MTemplateProject/scripts/prepare_resources-ios.py | 56+++++++++++++++++++++++++++++++-------------------------
MTemplateProject/scripts/prepare_resources-mac.py | 64+++++++++++++++++++++++++++++++++++++---------------------------
MTemplateProject/scripts/prepare_resources-win.py | 110++++++++++++++++++++++++++++++++++++++++---------------------------------------
MTemplateProject/scripts/update_installer-win.py | 109+++++++++++++++++++++++++++++++++++++++++--------------------------------------
MTemplateProject/scripts/update_version-ios.py | 231+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
MTemplateProject/scripts/update_version-mac.py | 445+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mbump_version.py | 4+---
Mduplicate.py | 535+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
18 files changed, 1629 insertions(+), 1177 deletions(-)

diff --git a/NeuralAmpModeler/Colors.h b/NeuralAmpModeler/Colors.h @@ -13,6 +13,7 @@ namespace PluginColors { +// HINT: ARGB // COLORS! const iplug::igraphics::IColor OFF_WHITE(255, 243, 246, 249); // Material UI because Heidi said so @@ -68,8 +69,9 @@ const iplug::igraphics::IColor NAM_3(255, 162, 178, 191); // Cadet Blue Crayola // Evan Heritage theme colors const iplug::igraphics::IColor NAM_0(0, 18, 17, 19); // Transparent -const iplug::igraphics::IColor NAM_THEMECOLOR(255, 80, 133, 232); // Azure -const iplug::igraphics::IColor NAM_THEMEFONTCOLOR(255, 242, 242, 242); // Dark Ehite +// const iplug::igraphics::IColor NAM_THEMECOLOR(255, 80, 133, 232); // Azure +const iplug::igraphics::IColor NAM_THEMECOLOR(255, 23, 190, 187); // Custom :) +const iplug::igraphics::IColor NAM_THEMEFONTCOLOR(255, 242, 242, 242); // Dark White // Misc // const iplug::igraphics::IColor MOUSEOVER = NAM_3.WithOpacity(0.3); diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp @@ -865,12 +865,13 @@ void NeuralAmpModeler::_ProcessInput(iplug::sample** inputs, const size_t nFrame { // We'll assume that the main processing is mono for now. We'll handle dual amps later. // See also: this->mNUM_INTERNAL_CHANNELS - if (nChansOut != 1) { + if (nChansOut != 1) + { std::stringstream ss; ss << "Expected mono output, but " << nChansOut << " output channels are requested!"; throw std::runtime_error(ss.str()); } - + // Assume _PrepareBuffers() was already called const double gain = pow(10.0, GetParam(kInputLevel)->Value() / 20.0); for (size_t c = 0; c < nChansIn; c++) diff --git a/NeuralAmpModeler/scripts/makezip-win.py b/NeuralAmpModeler/scripts/makezip-win.py @@ -5,69 +5,76 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "..\..\iPlug2" -sys.path.insert(0, os.path.join(scriptpath, IPLUG2_ROOT + '\Scripts')) +sys.path.insert(0, os.path.join(scriptpath, IPLUG2_ROOT + "\Scripts")) from get_archive_name import get_archive_name + def main(): - if len(sys.argv) != 3: - print("Usage: make_zip.py demo[0/1] zip[0/1]") - sys.exit(1) - else: - demo=int(sys.argv[1]) - zip=int(sys.argv[2]) - - dir = projectpath + "\\build-win\\out" - - if os.path.exists(dir): - shutil.rmtree(dir) - - os.makedirs(dir) - - files = [] - - if not zip: - installer = "\\build-win\\installer\\NeuralAmpModeler Installer.exe" - - if demo: - installer = "\\build-win\\installer\\NeuralAmpModeler Demo Installer.exe" - - files = [ - projectpath + installer, - projectpath + "\\installer\\changelog.txt", - projectpath + "\\installer\\known-issues.txt", - projectpath + "\\manual\\NeuralAmpModeler manual.pdf" - ] - else: - files = [ - projectpath + "\\build-win\\NeuralAmpModeler.vst3\\Contents\\x86_64-win\\NeuralAmpModeler.vst3", - projectpath + "\\build-win\\NeuralAmpModeler_x64.exe" - ] + if len(sys.argv) != 3: + print("Usage: make_zip.py demo[0/1] zip[0/1]") + sys.exit(1) + else: + demo = int(sys.argv[1]) + zip = int(sys.argv[2]) + + dir = projectpath + "\\build-win\\out" + + if os.path.exists(dir): + shutil.rmtree(dir) + + os.makedirs(dir) - zipname = get_archive_name(projectpath, "win", "demo" if demo == 1 else "full" ) + files = [] - zf = zipfile.ZipFile(projectpath + "\\build-win\\out\\" + zipname + ".zip", mode="w") + if not zip: + installer = "\\build-win\\installer\\NeuralAmpModeler Installer.exe" - for f in files: - print("adding " + f) - zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) + if demo: + installer = "\\build-win\\installer\\NeuralAmpModeler Demo Installer.exe" - zf.close() - print("wrote " + zipname) + files = [ + projectpath + installer, + projectpath + "\\installer\\changelog.txt", + projectpath + "\\installer\\known-issues.txt", + projectpath + "\\manual\\NeuralAmpModeler manual.pdf", + ] + else: + files = [ + projectpath + + "\\build-win\\NeuralAmpModeler.vst3\\Contents\\x86_64-win\\NeuralAmpModeler.vst3", + projectpath + "\\build-win\\NeuralAmpModeler_x64.exe", + ] - zf = zipfile.ZipFile(projectpath + "\\build-win\\out\\" + zipname + "-pdbs.zip", mode="w") + zipname = get_archive_name(projectpath, "win", "demo" if demo == 1 else "full") + + zf = zipfile.ZipFile( + projectpath + "\\build-win\\out\\" + zipname + ".zip", mode="w" + ) + + for f in files: + print("adding " + f) + zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) + + zf.close() + print("wrote " + zipname) + + zf = zipfile.ZipFile( + projectpath + "\\build-win\\out\\" + zipname + "-pdbs.zip", mode="w" + ) + + files = [ + projectpath + "\\build-win\\pdbs\\NeuralAmpModeler-vst3_x64.pdb", + projectpath + "\\build-win\\pdbs\\NeuralAmpModeler-app_x64.pdb", + ] - files = [ - projectpath + "\\build-win\\pdbs\\NeuralAmpModeler-vst3_x64.pdb", - projectpath + "\\build-win\\pdbs\\NeuralAmpModeler-app_x64.pdb" - ] + for f in files: + print("adding " + f) + zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) - for f in files: - print("adding " + f) - zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) + zf.close() + print("wrote " + zipname) - zf.close() - print("wrote " + zipname) -if __name__ == '__main__': - main() +if __name__ == "__main__": + main() diff --git a/NeuralAmpModeler/scripts/prepare_resources-ios.py b/NeuralAmpModeler/scripts/prepare_resources-ios.py @@ -2,10 +2,10 @@ # this script will create/update info plist files based on config.h -kAudioUnitType_MusicDevice = "aumu" -kAudioUnitType_MusicEffect = "aumf" -kAudioUnitType_Effect = "aufx" -kAudioUnitType_MIDIProcessor = "aumi" +kAudioUnitType_MusicDevice = "aumu" +kAudioUnitType_MusicEffect = "aumf" +kAudioUnitType_Effect = "aufx" +kAudioUnitType_MIDIProcessor = "aumi" import plistlib, os, datetime, fileinput, glob, sys, string, shutil @@ -14,28 +14,34 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config, parse_xcconfig + def main(): - if(len(sys.argv) == 2): - if(sys.argv[1] == "app"): - print("Copying resources ...") - - dst = os.environ["TARGET_BUILD_DIR"] + "/" + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] - - if os.path.exists(projectpath + "/resources/img/"): - imgs = os.listdir(projectpath + "/resources/img/") - for img in imgs: - print("copying " + img + " to " + dst) - shutil.copy(projectpath + "/resources/img/" + img, dst) - - if os.path.exists(projectpath + "/resources/fonts/"): - fonts = os.listdir(projectpath + "/resources/fonts/") - for font in fonts: - print("copying " + font + " to " + dst) - shutil.copy(projectpath + "/resources/fonts/" + font, dst) - -if __name__ == '__main__': - main() + if len(sys.argv) == 2: + if sys.argv[1] == "app": + print("Copying resources ...") + + dst = ( + os.environ["TARGET_BUILD_DIR"] + + "/" + + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] + ) + + if os.path.exists(projectpath + "/resources/img/"): + imgs = os.listdir(projectpath + "/resources/img/") + for img in imgs: + print("copying " + img + " to " + dst) + shutil.copy(projectpath + "/resources/img/" + img, dst) + + if os.path.exists(projectpath + "/resources/fonts/"): + fonts = os.listdir(projectpath + "/resources/fonts/") + for font in fonts: + print("copying " + font + " to " + dst) + shutil.copy(projectpath + "/resources/fonts/" + font, dst) + + +if __name__ == "__main__": + main() diff --git a/NeuralAmpModeler/scripts/prepare_resources-mac.py b/NeuralAmpModeler/scripts/prepare_resources-mac.py @@ -13,34 +13,44 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config -def main(): - config = parse_config(projectpath) - - print("Copying resources ...") - - if config['PLUG_SHARED_RESOURCES']: - dst = os.path.expanduser("~") + "/Music/" + config['SHARED_RESOURCES_SUBPATH'] + "/Resources" - else: - dst = os.environ["TARGET_BUILD_DIR"] + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] - - if os.path.exists(dst) == False: - os.makedirs(dst + "/", 0o0755 ) - if os.path.exists(projectpath + "/resources/img/"): - imgs = os.listdir(projectpath + "/resources/img/") - for img in imgs: - print("copying " + img + " to " + dst) - shutil.copy(projectpath + "/resources/img/" + img, dst) - - if os.path.exists(projectpath + "/resources/fonts/"): - fonts = os.listdir(projectpath + "/resources/fonts/") - for font in fonts: - print("copying " + font + " to " + dst) - shutil.copy(projectpath + "/resources/fonts/" + font, dst) - -if __name__ == '__main__': - main() +def main(): + config = parse_config(projectpath) + + print("Copying resources ...") + + if config["PLUG_SHARED_RESOURCES"]: + dst = ( + os.path.expanduser("~") + + "/Music/" + + config["SHARED_RESOURCES_SUBPATH"] + + "/Resources" + ) + else: + dst = ( + os.environ["TARGET_BUILD_DIR"] + + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] + ) + + if os.path.exists(dst) == False: + os.makedirs(dst + "/", 0o0755) + + if os.path.exists(projectpath + "/resources/img/"): + imgs = os.listdir(projectpath + "/resources/img/") + for img in imgs: + print("copying " + img + " to " + dst) + shutil.copy(projectpath + "/resources/img/" + img, dst) + + if os.path.exists(projectpath + "/resources/fonts/"): + fonts = os.listdir(projectpath + "/resources/fonts/") + for font in fonts: + print("copying " + font + " to " + dst) + shutil.copy(projectpath + "/resources/fonts/" + font, dst) + + +if __name__ == "__main__": + main() diff --git a/NeuralAmpModeler/scripts/prepare_resources-win.py b/NeuralAmpModeler/scripts/prepare_resources-win.py @@ -7,62 +7,64 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config + def main(): - print("not modifying rc file"); - # config = parse_config(projectpath) - - # rc = open(projectpath + "/resources/main.rc", "w") - - # rc.write("\n") - # rc.write("/////////////////////////////////////////////////////////////////////////////\n") - # rc.write("// Version\n") - # rc.write("/////////////////////////////////////////////////////////////////////////////\n") - # rc.write("VS_VERSION_INFO VERSIONINFO\n") - # rc.write("FILEVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") - # rc.write("PRODUCTVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") - # rc.write(" FILEFLAGSMASK 0x3fL\n") - # rc.write("#ifdef _DEBUG\n") - # rc.write(" FILEFLAGS 0x1L\n") - # rc.write("#else\n") - # rc.write(" FILEFLAGS 0x0L\n") - # rc.write("#endif\n") - # rc.write(" FILEOS 0x40004L\n") - # rc.write(" FILETYPE 0x1L\n") - # rc.write(" FILESUBTYPE 0x0L\n") - # rc.write("BEGIN\n") - # rc.write(' BLOCK "StringFileInfo"\n') - # rc.write(" BEGIN\n") - # rc.write(' BLOCK "040004e4"\n') - # rc.write(" BEGIN\n") - # rc.write(' VALUE "FileVersion", "' + config['FULL_VER_STR'] + '"\0\n') - # rc.write(' VALUE "ProductVersion", "' + config['FULL_VER_STR'] + '"0\n') - # rc.write("#ifdef VST2_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.dll"\0\n') - # rc.write("#elif defined VST3_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.vst3"\0\n') - # rc.write("#elif defined AAX_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.aaxplugin"\0\n') - # rc.write("#elif defined APP_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.exe"\0\n') - # rc.write("#endif\n") - # rc.write(' VALUE "FileDescription", "' + config['PLUG_NAME'] + '"\0\n') - # rc.write(' VALUE "InternalName", "' + config['PLUG_NAME'] + '"\0\n') - # rc.write(' VALUE "ProductName", "' + config['PLUG_NAME'] + '"\0\n') - # rc.write(' VALUE "CompanyName", "' + config['PLUG_MFR'] + '"\0\n') - # rc.write(' VALUE "LegalCopyright", "' + config['PLUG_COPYRIGHT_STR'] + '"\0\n') - # rc.write(' VALUE "LegalTrademarks", "' + config['PLUG_TRADEMARKS'] + '"\0\n') - # rc.write(" END\n") - # rc.write(" END\n") - # rc.write(' BLOCK "VarFileInfo"\n') - # rc.write(" BEGIN\n") - # rc.write(' VALUE "Translation", 0x400, 1252\n') - # rc.write(" END\n") - # rc.write("END\n") - # rc.write("\n") + print("not modifying rc file") + # config = parse_config(projectpath) + + # rc = open(projectpath + "/resources/main.rc", "w") + + # rc.write("\n") + # rc.write("/////////////////////////////////////////////////////////////////////////////\n") + # rc.write("// Version\n") + # rc.write("/////////////////////////////////////////////////////////////////////////////\n") + # rc.write("VS_VERSION_INFO VERSIONINFO\n") + # rc.write("FILEVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") + # rc.write("PRODUCTVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") + # rc.write(" FILEFLAGSMASK 0x3fL\n") + # rc.write("#ifdef _DEBUG\n") + # rc.write(" FILEFLAGS 0x1L\n") + # rc.write("#else\n") + # rc.write(" FILEFLAGS 0x0L\n") + # rc.write("#endif\n") + # rc.write(" FILEOS 0x40004L\n") + # rc.write(" FILETYPE 0x1L\n") + # rc.write(" FILESUBTYPE 0x0L\n") + # rc.write("BEGIN\n") + # rc.write(' BLOCK "StringFileInfo"\n') + # rc.write(" BEGIN\n") + # rc.write(' BLOCK "040004e4"\n') + # rc.write(" BEGIN\n") + # rc.write(' VALUE "FileVersion", "' + config['FULL_VER_STR'] + '"\0\n') + # rc.write(' VALUE "ProductVersion", "' + config['FULL_VER_STR'] + '"0\n') + # rc.write("#ifdef VST2_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.dll"\0\n') + # rc.write("#elif defined VST3_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.vst3"\0\n') + # rc.write("#elif defined AAX_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.aaxplugin"\0\n') + # rc.write("#elif defined APP_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.exe"\0\n') + # rc.write("#endif\n") + # rc.write(' VALUE "FileDescription", "' + config['PLUG_NAME'] + '"\0\n') + # rc.write(' VALUE "InternalName", "' + config['PLUG_NAME'] + '"\0\n') + # rc.write(' VALUE "ProductName", "' + config['PLUG_NAME'] + '"\0\n') + # rc.write(' VALUE "CompanyName", "' + config['PLUG_MFR'] + '"\0\n') + # rc.write(' VALUE "LegalCopyright", "' + config['PLUG_COPYRIGHT_STR'] + '"\0\n') + # rc.write(' VALUE "LegalTrademarks", "' + config['PLUG_TRADEMARKS'] + '"\0\n') + # rc.write(" END\n") + # rc.write(" END\n") + # rc.write(' BLOCK "VarFileInfo"\n') + # rc.write(" BEGIN\n") + # rc.write(' VALUE "Translation", 0x400, 1252\n') + # rc.write(" END\n") + # rc.write("END\n") + # rc.write("\n") + -if __name__ == '__main__': - main() +if __name__ == "__main__": + main() diff --git a/NeuralAmpModeler/scripts/update_installer-win.py b/NeuralAmpModeler/scripts/update_installer-win.py @@ -3,66 +3,71 @@ # this script will update the version and text in the innosetup installer files, based on config.h and demo 1/0 import plistlib, os, datetime, fileinput, glob, sys, string + scriptpath = os.path.dirname(os.path.realpath(__file__)) projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config + def replacestrs(filename, s, r): - files = glob.glob(filename) - - for line in fileinput.input(files,inplace=1): - string.find(line, s) - line = line.replace(s, r) - sys.stdout.write(line) + files = glob.glob(filename) + + for line in fileinput.input(files, inplace=1): + string.find(line, s) + line = line.replace(s, r) + sys.stdout.write(line) + def main(): - demo = 0 - - if len(sys.argv) != 2: - print("Usage: update_installer_version.py demo(0 or 1)") - sys.exit(1) - else: - demo=int(sys.argv[1]) - - config = parse_config(projectpath) - -# WIN INSTALLER - print("Updating Windows Installer version info...") - - for line in fileinput.input(projectpath + "/installer/" + config['BUNDLE_NAME'] + ".iss",inplace=1): - if "AppVersion" in line: - line="AppVersion=" + config['FULL_VER_STR'] + "\n" - if "OutputBaseFilename" in line: - if demo: - line="OutputBaseFilename=NeuralAmpModeler Demo Installer\n" - else: - line="OutputBaseFilename=NeuralAmpModeler Installer\n" - - if 'Source: "readme' in line: - if demo: - line='Source: "readme-win-demo.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' - else: - line='Source: "readme-win.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' - - if "WelcomeLabel1" in line: - if demo: - line="WelcomeLabel1=Welcome to the NeuralAmpModeler Demo installer\n" - else: - line="WelcomeLabel1=Welcome to the NeuralAmpModeler installer\n" - - if "SetupWindowTitle" in line: - if demo: - line="SetupWindowTitle=NeuralAmpModeler Demo installer\n" - else: - line="SetupWindowTitle=NeuralAmpModeler installer\n" - - sys.stdout.write(line) - - -if __name__ == '__main__': - main() + demo = 0 + + if len(sys.argv) != 2: + print("Usage: update_installer_version.py demo(0 or 1)") + sys.exit(1) + else: + demo = int(sys.argv[1]) + + config = parse_config(projectpath) + + # WIN INSTALLER + print("Updating Windows Installer version info...") + + for line in fileinput.input( + projectpath + "/installer/" + config["BUNDLE_NAME"] + ".iss", inplace=1 + ): + if "AppVersion" in line: + line = "AppVersion=" + config["FULL_VER_STR"] + "\n" + if "OutputBaseFilename" in line: + if demo: + line = "OutputBaseFilename=NeuralAmpModeler Demo Installer\n" + else: + line = "OutputBaseFilename=NeuralAmpModeler Installer\n" + + if 'Source: "readme' in line: + if demo: + line = 'Source: "readme-win-demo.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' + else: + line = 'Source: "readme-win.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' + + if "WelcomeLabel1" in line: + if demo: + line = "WelcomeLabel1=Welcome to the NeuralAmpModeler Demo installer\n" + else: + line = "WelcomeLabel1=Welcome to the NeuralAmpModeler installer\n" + + if "SetupWindowTitle" in line: + if demo: + line = "SetupWindowTitle=NeuralAmpModeler Demo installer\n" + else: + line = "SetupWindowTitle=NeuralAmpModeler installer\n" + + sys.stdout.write(line) + + +if __name__ == "__main__": + main() diff --git a/NeuralAmpModeler/scripts/update_version-ios.py b/NeuralAmpModeler/scripts/update_version-ios.py @@ -9,101 +9,148 @@ IPLUG2_ROOT = "../../iPlug2" scriptpath = os.path.dirname(os.path.realpath(__file__)) projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) -kAudioUnitType_MusicDevice = "aumu" -kAudioUnitType_MusicEffect = "aumf" -kAudioUnitType_Effect = "aufx" -kAudioUnitType_MIDIProcessor = "aumi" +kAudioUnitType_MusicDevice = "aumu" +kAudioUnitType_MusicEffect = "aumf" +kAudioUnitType_Effect = "aufx" +kAudioUnitType_MIDIProcessor = "aumi" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config, parse_xcconfig -def main(): - config = parse_config(projectpath) - xcconfig = parse_xcconfig(os.path.join(os.getcwd(), IPLUG2_ROOT + '/../common-ios.xcconfig')) - - CFBundleGetInfoString = config['BUNDLE_NAME'] + " v" + config['FULL_VER_STR'] + " " + config['PLUG_COPYRIGHT_STR'] - CFBundleVersion = config['FULL_VER_STR'] - CFBundlePackageType = "BNDL" - CSResourcesFileMapped = True - LSMinimumSystemVersion = xcconfig['DEPLOYMENT_TARGET'] - - print("Processing Info.plist files...") - -# AUDIOUNIT v3 - if config['PLUG_TYPE'] == 0: - if config['PLUG_DOES_MIDI_IN']: - COMPONENT_TYPE = kAudioUnitType_MusicEffect - else: - COMPONENT_TYPE = kAudioUnitType_Effect - elif config['PLUG_TYPE'] == 1: - COMPONENT_TYPE = kAudioUnitType_MusicDevice - elif config['PLUG_TYPE'] == 2: - COMPONENT_TYPE = kAudioUnitType_MIDIProcessor - - if config['PLUG_HAS_UI'] == 1: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" - else: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-iOS-AUv3-Info.plist" - - NSEXTENSIONATTRDICT = dict( - NSExtensionAttributes = dict(AudioComponents = [{}]), - NSExtensionPointIdentifier = NSEXTENSIONPOINTIDENTIFIER - ) - - with open(plistpath, 'rb') as f: - auv3 = plistlib.load(f) - auv3['CFBundleExecutable'] = config['BUNDLE_NAME'] + "AppExtension" - auv3['CFBundleIdentifier'] = "$(PRODUCT_BUNDLE_IDENTIFIER)" - auv3['CFBundleName'] = config['BUNDLE_NAME'] + "AppExtension" - auv3['CFBundleDisplayName'] = config['BUNDLE_NAME'] + "AppExtension" - auv3['CFBundleVersion'] = CFBundleVersion - auv3['CFBundleShortVersionString'] = CFBundleVersion - auv3['CFBundlePackageType'] = "XPC!" - auv3['NSExtension'] = NSEXTENSIONATTRDICT - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'] = [{}] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['description'] = config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['manufacturer'] = config['PLUG_MFR_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['name'] = config['PLUG_MFR'] + ": " + config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['subtype'] = config['PLUG_UNIQUE_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['type'] = COMPONENT_TYPE - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['version'] = config['PLUG_VERSION_INT'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['sandboxSafe'] = True - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'] = ["",""] - - if config['PLUG_TYPE'] == 1: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Synth" - else: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Effects" - - if config['PLUG_HAS_UI'] == 1: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][1] = "size:{" + str(config['PLUG_WIDTH']) + "," + str(config['PLUG_HEIGHT']) + "}" - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['factoryFunction'] = "IPlugAUViewController_vNeuralAmpModeler" - auv3['NSExtension']['NSExtensionMainStoryboard'] = config['BUNDLE_NAME'] + "-iOS-MainInterface" +def main(): + config = parse_config(projectpath) + xcconfig = parse_xcconfig( + os.path.join(os.getcwd(), IPLUG2_ROOT + "/../common-ios.xcconfig") + ) + + CFBundleGetInfoString = ( + config["BUNDLE_NAME"] + + " v" + + config["FULL_VER_STR"] + + " " + + config["PLUG_COPYRIGHT_STR"] + ) + CFBundleVersion = config["FULL_VER_STR"] + CFBundlePackageType = "BNDL" + CSResourcesFileMapped = True + LSMinimumSystemVersion = xcconfig["DEPLOYMENT_TARGET"] + + print("Processing Info.plist files...") + + # AUDIOUNIT v3 + + if config["PLUG_TYPE"] == 0: + if config["PLUG_DOES_MIDI_IN"]: + COMPONENT_TYPE = kAudioUnitType_MusicEffect + else: + COMPONENT_TYPE = kAudioUnitType_Effect + elif config["PLUG_TYPE"] == 1: + COMPONENT_TYPE = kAudioUnitType_MusicDevice + elif config["PLUG_TYPE"] == 2: + COMPONENT_TYPE = kAudioUnitType_MIDIProcessor + + if config["PLUG_HAS_UI"] == 1: + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" else: - auv3['NSExtension']['NSExtensionPrincipalClass'] = "IPlugAUViewController_vNeuralAmpModeler" - - with open(plistpath, 'wb') as f2: - plistlib.dump(auv3, f2) - -# Standalone APP - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-iOS-Info.plist" - with open(plistpath, 'rb') as f: - iOSapp = plistlib.load(f) - iOSapp['CFBundleExecutable'] = config['BUNDLE_NAME'] - iOSapp['CFBundleIdentifier'] = "$(PRODUCT_BUNDLE_IDENTIFIER)" - iOSapp['CFBundleName'] = config['BUNDLE_NAME'] - iOSapp['CFBundleVersion'] = CFBundleVersion - iOSapp['CFBundleShortVersionString'] = CFBundleVersion - iOSapp['CFBundlePackageType'] = "APPL" - iOSapp['LSApplicationCategoryType'] = "public.app-category.music" - - with open(plistpath, 'wb') as f2: - plistlib.dump(iOSapp, f2) - -if __name__ == '__main__': - main() + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" + + plistpath = ( + projectpath + "/resources/" + config["BUNDLE_NAME"] + "-iOS-AUv3-Info.plist" + ) + + NSEXTENSIONATTRDICT = dict( + NSExtensionAttributes=dict(AudioComponents=[{}]), + NSExtensionPointIdentifier=NSEXTENSIONPOINTIDENTIFIER, + ) + + with open(plistpath, "rb") as f: + auv3 = plistlib.load(f) + auv3["CFBundleExecutable"] = config["BUNDLE_NAME"] + "AppExtension" + auv3["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)" + auv3["CFBundleName"] = config["BUNDLE_NAME"] + "AppExtension" + auv3["CFBundleDisplayName"] = config["BUNDLE_NAME"] + "AppExtension" + auv3["CFBundleVersion"] = CFBundleVersion + auv3["CFBundleShortVersionString"] = CFBundleVersion + auv3["CFBundlePackageType"] = "XPC!" + auv3["NSExtension"] = NSEXTENSIONATTRDICT + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"] = [{}] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "description" + ] = config["PLUG_NAME"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "manufacturer" + ] = config["PLUG_MFR_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["name"] = ( + config["PLUG_MFR"] + ": " + config["PLUG_NAME"] + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "subtype" + ] = config["PLUG_UNIQUE_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "type" + ] = COMPONENT_TYPE + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "version" + ] = config["PLUG_VERSION_INT"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "sandboxSafe" + ] = True + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"] = [ + "", + "", + ] + + if config["PLUG_TYPE"] == 1: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Synth" + else: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Effects" + + if config["PLUG_HAS_UI"] == 1: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 1 + ] = ( + "size:{" + + str(config["PLUG_WIDTH"]) + + "," + + str(config["PLUG_HEIGHT"]) + + "}" + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "factoryFunction" + ] = "IPlugAUViewController_vNeuralAmpModeler" + auv3["NSExtension"]["NSExtensionMainStoryboard"] = ( + config["BUNDLE_NAME"] + "-iOS-MainInterface" + ) + else: + auv3["NSExtension"][ + "NSExtensionPrincipalClass" + ] = "IPlugAUViewController_vNeuralAmpModeler" + + with open(plistpath, "wb") as f2: + plistlib.dump(auv3, f2) + + # Standalone APP + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-iOS-Info.plist" + with open(plistpath, "rb") as f: + iOSapp = plistlib.load(f) + iOSapp["CFBundleExecutable"] = config["BUNDLE_NAME"] + iOSapp["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)" + iOSapp["CFBundleName"] = config["BUNDLE_NAME"] + iOSapp["CFBundleVersion"] = CFBundleVersion + iOSapp["CFBundleShortVersionString"] = CFBundleVersion + iOSapp["CFBundlePackageType"] = "APPL" + iOSapp["LSApplicationCategoryType"] = "public.app-category.music" + + with open(plistpath, "wb") as f2: + plistlib.dump(iOSapp, f2) + + +if __name__ == "__main__": + main() diff --git a/NeuralAmpModeler/scripts/update_version-mac.py b/NeuralAmpModeler/scripts/update_version-mac.py @@ -9,190 +9,273 @@ IPLUG2_ROOT = "../../iPlug2" scriptpath = os.path.dirname(os.path.realpath(__file__)) projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) -kAudioUnitType_MusicDevice = "aumu" -kAudioUnitType_MusicEffect = "aumf" -kAudioUnitType_Effect = "aufx" -kAudioUnitType_MIDIProcessor = "aumi" +kAudioUnitType_MusicDevice = "aumu" +kAudioUnitType_MusicEffect = "aumf" +kAudioUnitType_Effect = "aufx" +kAudioUnitType_MIDIProcessor = "aumi" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config, parse_xcconfig + def main(): - config = parse_config(projectpath) - xcconfig = parse_xcconfig(os.path.join(os.getcwd(), IPLUG2_ROOT + '/../common-mac.xcconfig')) - - CFBundleGetInfoString = config['BUNDLE_NAME'] + " v" + config['FULL_VER_STR'] + " " + config['PLUG_COPYRIGHT_STR'] - CFBundleVersion = config['FULL_VER_STR'] - CFBundlePackageType = "BNDL" - CSResourcesFileMapped = True - LSMinimumSystemVersion = xcconfig['DEPLOYMENT_TARGET'] - - print("Processing Info.plist files...") - -# VST3 - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-VST3-Info.plist" - with open(plistpath, 'rb') as f: - vst3 = plistlib.load(f) - vst3['CFBundleExecutable'] = config['BUNDLE_NAME'] - vst3['CFBundleGetInfoString'] = CFBundleGetInfoString - vst3['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".vst3." + config['BUNDLE_NAME'] + "" - vst3['CFBundleName'] = config['BUNDLE_NAME'] - vst3['CFBundleVersion'] = CFBundleVersion - vst3['CFBundleShortVersionString'] = CFBundleVersion - vst3['LSMinimumSystemVersion'] = LSMinimumSystemVersion - vst3['CFBundlePackageType'] = CFBundlePackageType - vst3['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - vst3['CSResourcesFileMapped'] = CSResourcesFileMapped - - with open(plistpath, 'wb') as f2: - plistlib.dump(vst3, f2) - -# VST2 - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-VST2-Info.plist" - with open(plistpath, 'rb') as f: - vst2 = plistlib.load(f) - vst2['CFBundleExecutable'] = config['BUNDLE_NAME'] - vst2['CFBundleGetInfoString'] = CFBundleGetInfoString - vst2['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".vst." + config['BUNDLE_NAME'] + "" - vst2['CFBundleName'] = config['BUNDLE_NAME'] - vst2['CFBundleVersion'] = CFBundleVersion - vst2['CFBundleShortVersionString'] = CFBundleVersion - vst2['LSMinimumSystemVersion'] = LSMinimumSystemVersion - vst2['CFBundlePackageType'] = CFBundlePackageType - vst2['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - vst2['CSResourcesFileMapped'] = CSResourcesFileMapped - - with open(plistpath, 'wb') as f2: - plistlib.dump(vst2, f2) - -# AUDIOUNIT v2 - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-AU-Info.plist" - with open(plistpath, 'rb') as f: - auv2 = plistlib.load(f) - auv2['CFBundleExecutable'] = config['BUNDLE_NAME'] - auv2['CFBundleGetInfoString'] = CFBundleGetInfoString - auv2['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".audiounit." + config['BUNDLE_NAME'] + "" - auv2['CFBundleName'] = config['BUNDLE_NAME'] - auv2['CFBundleVersion'] = CFBundleVersion - auv2['CFBundleShortVersionString'] = CFBundleVersion - auv2['LSMinimumSystemVersion'] = LSMinimumSystemVersion - auv2['CFBundlePackageType'] = CFBundlePackageType - auv2['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - auv2['CSResourcesFileMapped'] = CSResourcesFileMapped - - if config['PLUG_TYPE'] == 0: - if config['PLUG_DOES_MIDI_IN']: - COMPONENT_TYPE = kAudioUnitType_MusicEffect - else: - COMPONENT_TYPE = kAudioUnitType_Effect - elif config['PLUG_TYPE'] == 1: - COMPONENT_TYPE = kAudioUnitType_MusicDevice - elif config['PLUG_TYPE'] == 2: - COMPONENT_TYPE = kAudioUnitType_MIDIProcessor - - auv2['AudioUnit Version'] = config['PLUG_VERSION_HEX'] - auv2['AudioComponents'] = [{}] - auv2['AudioComponents'][0]['description'] = config['PLUG_NAME'] - auv2['AudioComponents'][0]['factoryFunction'] = config['AUV2_FACTORY'] - auv2['AudioComponents'][0]['manufacturer'] = config['PLUG_MFR_ID'] - auv2['AudioComponents'][0]['name'] = config['PLUG_MFR'] + ": " + config['PLUG_NAME'] - auv2['AudioComponents'][0]['subtype'] = config['PLUG_UNIQUE_ID'] - auv2['AudioComponents'][0]['type'] = COMPONENT_TYPE - auv2['AudioComponents'][0]['version'] = config['PLUG_VERSION_INT'] - auv2['AudioComponents'][0]['sandboxSafe'] = True - - with open(plistpath, 'wb') as f2: - plistlib.dump(auv2, f2) - -# AUDIOUNIT v3 - - if config['PLUG_HAS_UI']: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" - else: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-macOS-AUv3-Info.plist" - - with open(plistpath, 'rb') as f: - auv3 = plistlib.load(f) - auv3['CFBundleExecutable'] = config['BUNDLE_NAME'] - auv3['CFBundleGetInfoString'] = CFBundleGetInfoString - auv3['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".app." + config['BUNDLE_NAME'] + ".AUv3" - auv3['CFBundleName'] = config['BUNDLE_NAME'] - auv3['CFBundleVersion'] = CFBundleVersion - auv3['CFBundleShortVersionString'] = CFBundleVersion - auv3['LSMinimumSystemVersion'] = "10.12.0" - auv3['CFBundlePackageType'] = "XPC!" - auv3['NSExtension'] = dict( - NSExtensionAttributes = dict( - AudioComponentBundle = "com.StevenAtkinson.app." + config['BUNDLE_NAME'] + ".AUv3Framework", - AudioComponents = [{}]), - # NSExtensionServiceRoleType = "NSExtensionServiceRoleTypeEditor", - NSExtensionPointIdentifier = NSEXTENSIONPOINTIDENTIFIER, - NSExtensionPrincipalClass = "IPlugAUViewController_vNeuralAmpModeler" - ) - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'] = [{}] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['description'] = config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['manufacturer'] = config['PLUG_MFR_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['name'] = config['PLUG_MFR'] + ": " + config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['subtype'] = config['PLUG_UNIQUE_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['type'] = COMPONENT_TYPE - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['version'] = config['PLUG_VERSION_INT'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['sandboxSafe'] = True - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'] = [{}] - - if config['PLUG_TYPE'] == 1: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Synth" + config = parse_config(projectpath) + xcconfig = parse_xcconfig( + os.path.join(os.getcwd(), IPLUG2_ROOT + "/../common-mac.xcconfig") + ) + + CFBundleGetInfoString = ( + config["BUNDLE_NAME"] + + " v" + + config["FULL_VER_STR"] + + " " + + config["PLUG_COPYRIGHT_STR"] + ) + CFBundleVersion = config["FULL_VER_STR"] + CFBundlePackageType = "BNDL" + CSResourcesFileMapped = True + LSMinimumSystemVersion = xcconfig["DEPLOYMENT_TARGET"] + + print("Processing Info.plist files...") + + # VST3 + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-VST3-Info.plist" + with open(plistpath, "rb") as f: + vst3 = plistlib.load(f) + vst3["CFBundleExecutable"] = config["BUNDLE_NAME"] + vst3["CFBundleGetInfoString"] = CFBundleGetInfoString + vst3["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".vst3." + + config["BUNDLE_NAME"] + + "" + ) + vst3["CFBundleName"] = config["BUNDLE_NAME"] + vst3["CFBundleVersion"] = CFBundleVersion + vst3["CFBundleShortVersionString"] = CFBundleVersion + vst3["LSMinimumSystemVersion"] = LSMinimumSystemVersion + vst3["CFBundlePackageType"] = CFBundlePackageType + vst3["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + vst3["CSResourcesFileMapped"] = CSResourcesFileMapped + + with open(plistpath, "wb") as f2: + plistlib.dump(vst3, f2) + + # VST2 + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-VST2-Info.plist" + with open(plistpath, "rb") as f: + vst2 = plistlib.load(f) + vst2["CFBundleExecutable"] = config["BUNDLE_NAME"] + vst2["CFBundleGetInfoString"] = CFBundleGetInfoString + vst2["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".vst." + + config["BUNDLE_NAME"] + + "" + ) + vst2["CFBundleName"] = config["BUNDLE_NAME"] + vst2["CFBundleVersion"] = CFBundleVersion + vst2["CFBundleShortVersionString"] = CFBundleVersion + vst2["LSMinimumSystemVersion"] = LSMinimumSystemVersion + vst2["CFBundlePackageType"] = CFBundlePackageType + vst2["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + vst2["CSResourcesFileMapped"] = CSResourcesFileMapped + + with open(plistpath, "wb") as f2: + plistlib.dump(vst2, f2) + + # AUDIOUNIT v2 + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-AU-Info.plist" + with open(plistpath, "rb") as f: + auv2 = plistlib.load(f) + auv2["CFBundleExecutable"] = config["BUNDLE_NAME"] + auv2["CFBundleGetInfoString"] = CFBundleGetInfoString + auv2["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".audiounit." + + config["BUNDLE_NAME"] + + "" + ) + auv2["CFBundleName"] = config["BUNDLE_NAME"] + auv2["CFBundleVersion"] = CFBundleVersion + auv2["CFBundleShortVersionString"] = CFBundleVersion + auv2["LSMinimumSystemVersion"] = LSMinimumSystemVersion + auv2["CFBundlePackageType"] = CFBundlePackageType + auv2["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + auv2["CSResourcesFileMapped"] = CSResourcesFileMapped + + if config["PLUG_TYPE"] == 0: + if config["PLUG_DOES_MIDI_IN"]: + COMPONENT_TYPE = kAudioUnitType_MusicEffect + else: + COMPONENT_TYPE = kAudioUnitType_Effect + elif config["PLUG_TYPE"] == 1: + COMPONENT_TYPE = kAudioUnitType_MusicDevice + elif config["PLUG_TYPE"] == 2: + COMPONENT_TYPE = kAudioUnitType_MIDIProcessor + + auv2["AudioUnit Version"] = config["PLUG_VERSION_HEX"] + auv2["AudioComponents"] = [{}] + auv2["AudioComponents"][0]["description"] = config["PLUG_NAME"] + auv2["AudioComponents"][0]["factoryFunction"] = config["AUV2_FACTORY"] + auv2["AudioComponents"][0]["manufacturer"] = config["PLUG_MFR_ID"] + auv2["AudioComponents"][0]["name"] = ( + config["PLUG_MFR"] + ": " + config["PLUG_NAME"] + ) + auv2["AudioComponents"][0]["subtype"] = config["PLUG_UNIQUE_ID"] + auv2["AudioComponents"][0]["type"] = COMPONENT_TYPE + auv2["AudioComponents"][0]["version"] = config["PLUG_VERSION_INT"] + auv2["AudioComponents"][0]["sandboxSafe"] = True + + with open(plistpath, "wb") as f2: + plistlib.dump(auv2, f2) + + # AUDIOUNIT v3 + + if config["PLUG_HAS_UI"]: + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" else: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Effects" - - with open(plistpath, 'wb') as f2: - plistlib.dump(auv3, f2) - -# AAX - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-AAX-Info.plist" - with open(plistpath, 'rb') as f: - aax = plistlib.load(f) - aax['CFBundleExecutable'] = config['BUNDLE_NAME'] - aax['CFBundleGetInfoString'] = CFBundleGetInfoString - aax['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".aax." + config['BUNDLE_NAME'] + "" - aax['CFBundleName'] = config['BUNDLE_NAME'] - aax['CFBundleVersion'] = CFBundleVersion - aax['CFBundleShortVersionString'] = CFBundleVersion - aax['LSMinimumSystemVersion'] = LSMinimumSystemVersion - aax['CSResourcesFileMapped'] = CSResourcesFileMapped - - with open(plistpath, 'wb') as f2: - plistlib.dump(aax, f2) - -# APP - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-macOS-Info.plist" - - with open(plistpath, 'rb') as f: - macOSapp = plistlib.load(f) - macOSapp['CFBundleExecutable'] = config['BUNDLE_NAME'] - macOSapp['CFBundleGetInfoString'] = CFBundleGetInfoString - macOSapp['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".app." + config['BUNDLE_NAME'] + "" - macOSapp['CFBundleName'] = config['BUNDLE_NAME'] - macOSapp['CFBundleVersion'] = CFBundleVersion - macOSapp['CFBundleShortVersionString'] = CFBundleVersion - macOSapp['LSMinimumSystemVersion'] = LSMinimumSystemVersion - macOSapp['CFBundlePackageType'] = CFBundlePackageType - macOSapp['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - macOSapp['CSResourcesFileMapped'] = CSResourcesFileMapped - macOSapp['NSPrincipalClass'] = "SWELLApplication" - macOSapp['NSMainNibFile'] = config['BUNDLE_NAME'] + "-macOS-MainMenu" - macOSapp['LSApplicationCategoryType'] = "public.app-category.music" - macOSapp['NSMicrophoneUsageDescription'] = "This app needs mic access to process audio." - - with open(plistpath, 'wb') as f2: - plistlib.dump(macOSapp, f2) - -if __name__ == '__main__': - main() + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" + + plistpath = ( + projectpath + "/resources/" + config["BUNDLE_NAME"] + "-macOS-AUv3-Info.plist" + ) + + with open(plistpath, "rb") as f: + auv3 = plistlib.load(f) + auv3["CFBundleExecutable"] = config["BUNDLE_NAME"] + auv3["CFBundleGetInfoString"] = CFBundleGetInfoString + auv3["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".app." + + config["BUNDLE_NAME"] + + ".AUv3" + ) + auv3["CFBundleName"] = config["BUNDLE_NAME"] + auv3["CFBundleVersion"] = CFBundleVersion + auv3["CFBundleShortVersionString"] = CFBundleVersion + auv3["LSMinimumSystemVersion"] = "10.12.0" + auv3["CFBundlePackageType"] = "XPC!" + auv3["NSExtension"] = dict( + NSExtensionAttributes=dict( + AudioComponentBundle="com.StevenAtkinson.app." + + config["BUNDLE_NAME"] + + ".AUv3Framework", + AudioComponents=[{}], + ), + # NSExtensionServiceRoleType = "NSExtensionServiceRoleTypeEditor", + NSExtensionPointIdentifier=NSEXTENSIONPOINTIDENTIFIER, + NSExtensionPrincipalClass="IPlugAUViewController_vNeuralAmpModeler", + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"] = [{}] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "description" + ] = config["PLUG_NAME"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "manufacturer" + ] = config["PLUG_MFR_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["name"] = ( + config["PLUG_MFR"] + ": " + config["PLUG_NAME"] + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "subtype" + ] = config["PLUG_UNIQUE_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "type" + ] = COMPONENT_TYPE + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "version" + ] = config["PLUG_VERSION_INT"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "sandboxSafe" + ] = True + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"] = [ + {} + ] + + if config["PLUG_TYPE"] == 1: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Synth" + else: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Effects" + + with open(plistpath, "wb") as f2: + plistlib.dump(auv3, f2) + + # AAX + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-AAX-Info.plist" + with open(plistpath, "rb") as f: + aax = plistlib.load(f) + aax["CFBundleExecutable"] = config["BUNDLE_NAME"] + aax["CFBundleGetInfoString"] = CFBundleGetInfoString + aax["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".aax." + + config["BUNDLE_NAME"] + + "" + ) + aax["CFBundleName"] = config["BUNDLE_NAME"] + aax["CFBundleVersion"] = CFBundleVersion + aax["CFBundleShortVersionString"] = CFBundleVersion + aax["LSMinimumSystemVersion"] = LSMinimumSystemVersion + aax["CSResourcesFileMapped"] = CSResourcesFileMapped + + with open(plistpath, "wb") as f2: + plistlib.dump(aax, f2) + + # APP + + plistpath = ( + projectpath + "/resources/" + config["BUNDLE_NAME"] + "-macOS-Info.plist" + ) + + with open(plistpath, "rb") as f: + macOSapp = plistlib.load(f) + macOSapp["CFBundleExecutable"] = config["BUNDLE_NAME"] + macOSapp["CFBundleGetInfoString"] = CFBundleGetInfoString + macOSapp["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".app." + + config["BUNDLE_NAME"] + + "" + ) + macOSapp["CFBundleName"] = config["BUNDLE_NAME"] + macOSapp["CFBundleVersion"] = CFBundleVersion + macOSapp["CFBundleShortVersionString"] = CFBundleVersion + macOSapp["LSMinimumSystemVersion"] = LSMinimumSystemVersion + macOSapp["CFBundlePackageType"] = CFBundlePackageType + macOSapp["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + macOSapp["CSResourcesFileMapped"] = CSResourcesFileMapped + macOSapp["NSPrincipalClass"] = "SWELLApplication" + macOSapp["NSMainNibFile"] = config["BUNDLE_NAME"] + "-macOS-MainMenu" + macOSapp["LSApplicationCategoryType"] = "public.app-category.music" + macOSapp[ + "NSMicrophoneUsageDescription" + ] = "This app needs mic access to process audio." + + with open(plistpath, "wb") as f2: + plistlib.dump(macOSapp, f2) + + +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/makezip-win.py b/TemplateProject/scripts/makezip-win.py @@ -5,69 +5,76 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "..\..\iPlug2" -sys.path.insert(0, os.path.join(scriptpath, IPLUG2_ROOT + '\Scripts')) +sys.path.insert(0, os.path.join(scriptpath, IPLUG2_ROOT + "\Scripts")) from get_archive_name import get_archive_name + def main(): - if len(sys.argv) != 3: - print("Usage: make_zip.py demo[0/1] zip[0/1]") - sys.exit(1) - else: - demo=int(sys.argv[1]) - zip=int(sys.argv[2]) - - dir = projectpath + "\\build-win\\out" - - if os.path.exists(dir): - shutil.rmtree(dir) - - os.makedirs(dir) - - files = [] - - if not zip: - installer = "\\build-win\\installer\\TemplateProject Installer.exe" - - if demo: - installer = "\\build-win\\installer\\TemplateProject Demo Installer.exe" - - files = [ - projectpath + installer, - projectpath + "\\installer\\changelog.txt", - projectpath + "\\installer\\known-issues.txt", - projectpath + "\\manual\\TemplateProject manual.pdf" - ] - else: - files = [ - projectpath + "\\build-win\\TemplateProject.vst3\\Contents\\x86_64-win\\TemplateProject.vst3", - projectpath + "\\build-win\\TemplateProject_x64.exe" - ] + if len(sys.argv) != 3: + print("Usage: make_zip.py demo[0/1] zip[0/1]") + sys.exit(1) + else: + demo = int(sys.argv[1]) + zip = int(sys.argv[2]) + + dir = projectpath + "\\build-win\\out" + + if os.path.exists(dir): + shutil.rmtree(dir) + + os.makedirs(dir) - zipname = get_archive_name(projectpath, "win", "demo" if demo == 1 else "full" ) + files = [] - zf = zipfile.ZipFile(projectpath + "\\build-win\\out\\" + zipname + ".zip", mode="w") + if not zip: + installer = "\\build-win\\installer\\TemplateProject Installer.exe" - for f in files: - print("adding " + f) - zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) + if demo: + installer = "\\build-win\\installer\\TemplateProject Demo Installer.exe" - zf.close() - print("wrote " + zipname) + files = [ + projectpath + installer, + projectpath + "\\installer\\changelog.txt", + projectpath + "\\installer\\known-issues.txt", + projectpath + "\\manual\\TemplateProject manual.pdf", + ] + else: + files = [ + projectpath + + "\\build-win\\TemplateProject.vst3\\Contents\\x86_64-win\\TemplateProject.vst3", + projectpath + "\\build-win\\TemplateProject_x64.exe", + ] - zf = zipfile.ZipFile(projectpath + "\\build-win\\out\\" + zipname + "-pdbs.zip", mode="w") + zipname = get_archive_name(projectpath, "win", "demo" if demo == 1 else "full") + + zf = zipfile.ZipFile( + projectpath + "\\build-win\\out\\" + zipname + ".zip", mode="w" + ) + + for f in files: + print("adding " + f) + zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) + + zf.close() + print("wrote " + zipname) + + zf = zipfile.ZipFile( + projectpath + "\\build-win\\out\\" + zipname + "-pdbs.zip", mode="w" + ) + + files = [ + projectpath + "\\build-win\\pdbs\\TemplateProject-vst3_x64.pdb", + projectpath + "\\build-win\\pdbs\\TemplateProject-app_x64.pdb", + ] - files = [ - projectpath + "\\build-win\\pdbs\\TemplateProject-vst3_x64.pdb", - projectpath + "\\build-win\\pdbs\\TemplateProject-app_x64.pdb" - ] + for f in files: + print("adding " + f) + zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) - for f in files: - print("adding " + f) - zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED) + zf.close() + print("wrote " + zipname) - zf.close() - print("wrote " + zipname) -if __name__ == '__main__': - main() +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/prepare_resources-ios.py b/TemplateProject/scripts/prepare_resources-ios.py @@ -2,10 +2,10 @@ # this script will create/update info plist files based on config.h -kAudioUnitType_MusicDevice = "aumu" -kAudioUnitType_MusicEffect = "aumf" -kAudioUnitType_Effect = "aufx" -kAudioUnitType_MIDIProcessor = "aumi" +kAudioUnitType_MusicDevice = "aumu" +kAudioUnitType_MusicEffect = "aumf" +kAudioUnitType_Effect = "aufx" +kAudioUnitType_MIDIProcessor = "aumi" import plistlib, os, datetime, fileinput, glob, sys, string, shutil @@ -14,28 +14,34 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config, parse_xcconfig + def main(): - if(len(sys.argv) == 2): - if(sys.argv[1] == "app"): - print("Copying resources ...") - - dst = os.environ["TARGET_BUILD_DIR"] + "/" + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] - - if os.path.exists(projectpath + "/resources/img/"): - imgs = os.listdir(projectpath + "/resources/img/") - for img in imgs: - print("copying " + img + " to " + dst) - shutil.copy(projectpath + "/resources/img/" + img, dst) - - if os.path.exists(projectpath + "/resources/fonts/"): - fonts = os.listdir(projectpath + "/resources/fonts/") - for font in fonts: - print("copying " + font + " to " + dst) - shutil.copy(projectpath + "/resources/fonts/" + font, dst) - -if __name__ == '__main__': - main() + if len(sys.argv) == 2: + if sys.argv[1] == "app": + print("Copying resources ...") + + dst = ( + os.environ["TARGET_BUILD_DIR"] + + "/" + + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] + ) + + if os.path.exists(projectpath + "/resources/img/"): + imgs = os.listdir(projectpath + "/resources/img/") + for img in imgs: + print("copying " + img + " to " + dst) + shutil.copy(projectpath + "/resources/img/" + img, dst) + + if os.path.exists(projectpath + "/resources/fonts/"): + fonts = os.listdir(projectpath + "/resources/fonts/") + for font in fonts: + print("copying " + font + " to " + dst) + shutil.copy(projectpath + "/resources/fonts/" + font, dst) + + +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/prepare_resources-mac.py b/TemplateProject/scripts/prepare_resources-mac.py @@ -13,34 +13,44 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config -def main(): - config = parse_config(projectpath) - - print("Copying resources ...") - - if config['PLUG_SHARED_RESOURCES']: - dst = os.path.expanduser("~") + "/Music/" + config['SHARED_RESOURCES_SUBPATH'] + "/Resources" - else: - dst = os.environ["TARGET_BUILD_DIR"] + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] - - if os.path.exists(dst) == False: - os.makedirs(dst + "/", 0o0755 ) - if os.path.exists(projectpath + "/resources/img/"): - imgs = os.listdir(projectpath + "/resources/img/") - for img in imgs: - print("copying " + img + " to " + dst) - shutil.copy(projectpath + "/resources/img/" + img, dst) - - if os.path.exists(projectpath + "/resources/fonts/"): - fonts = os.listdir(projectpath + "/resources/fonts/") - for font in fonts: - print("copying " + font + " to " + dst) - shutil.copy(projectpath + "/resources/fonts/" + font, dst) - -if __name__ == '__main__': - main() +def main(): + config = parse_config(projectpath) + + print("Copying resources ...") + + if config["PLUG_SHARED_RESOURCES"]: + dst = ( + os.path.expanduser("~") + + "/Music/" + + config["SHARED_RESOURCES_SUBPATH"] + + "/Resources" + ) + else: + dst = ( + os.environ["TARGET_BUILD_DIR"] + + os.environ["UNLOCALIZED_RESOURCES_FOLDER_PATH"] + ) + + if os.path.exists(dst) == False: + os.makedirs(dst + "/", 0o0755) + + if os.path.exists(projectpath + "/resources/img/"): + imgs = os.listdir(projectpath + "/resources/img/") + for img in imgs: + print("copying " + img + " to " + dst) + shutil.copy(projectpath + "/resources/img/" + img, dst) + + if os.path.exists(projectpath + "/resources/fonts/"): + fonts = os.listdir(projectpath + "/resources/fonts/") + for font in fonts: + print("copying " + font + " to " + dst) + shutil.copy(projectpath + "/resources/fonts/" + font, dst) + + +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/prepare_resources-win.py b/TemplateProject/scripts/prepare_resources-win.py @@ -7,62 +7,64 @@ projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config + def main(): - print("not modifying rc file"); - # config = parse_config(projectpath) - - # rc = open(projectpath + "/resources/main.rc", "w") - - # rc.write("\n") - # rc.write("/////////////////////////////////////////////////////////////////////////////\n") - # rc.write("// Version\n") - # rc.write("/////////////////////////////////////////////////////////////////////////////\n") - # rc.write("VS_VERSION_INFO VERSIONINFO\n") - # rc.write("FILEVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") - # rc.write("PRODUCTVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") - # rc.write(" FILEFLAGSMASK 0x3fL\n") - # rc.write("#ifdef _DEBUG\n") - # rc.write(" FILEFLAGS 0x1L\n") - # rc.write("#else\n") - # rc.write(" FILEFLAGS 0x0L\n") - # rc.write("#endif\n") - # rc.write(" FILEOS 0x40004L\n") - # rc.write(" FILETYPE 0x1L\n") - # rc.write(" FILESUBTYPE 0x0L\n") - # rc.write("BEGIN\n") - # rc.write(' BLOCK "StringFileInfo"\n') - # rc.write(" BEGIN\n") - # rc.write(' BLOCK "040004e4"\n') - # rc.write(" BEGIN\n") - # rc.write(' VALUE "FileVersion", "' + config['FULL_VER_STR'] + '"\0\n') - # rc.write(' VALUE "ProductVersion", "' + config['FULL_VER_STR'] + '"0\n') - # rc.write("#ifdef VST2_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.dll"\0\n') - # rc.write("#elif defined VST3_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.vst3"\0\n') - # rc.write("#elif defined AAX_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.aaxplugin"\0\n') - # rc.write("#elif defined APP_API\n") - # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.exe"\0\n') - # rc.write("#endif\n") - # rc.write(' VALUE "FileDescription", "' + config['PLUG_NAME'] + '"\0\n') - # rc.write(' VALUE "InternalName", "' + config['PLUG_NAME'] + '"\0\n') - # rc.write(' VALUE "ProductName", "' + config['PLUG_NAME'] + '"\0\n') - # rc.write(' VALUE "CompanyName", "' + config['PLUG_MFR'] + '"\0\n') - # rc.write(' VALUE "LegalCopyright", "' + config['PLUG_COPYRIGHT_STR'] + '"\0\n') - # rc.write(' VALUE "LegalTrademarks", "' + config['PLUG_TRADEMARKS'] + '"\0\n') - # rc.write(" END\n") - # rc.write(" END\n") - # rc.write(' BLOCK "VarFileInfo"\n') - # rc.write(" BEGIN\n") - # rc.write(' VALUE "Translation", 0x400, 1252\n') - # rc.write(" END\n") - # rc.write("END\n") - # rc.write("\n") + print("not modifying rc file") + # config = parse_config(projectpath) + + # rc = open(projectpath + "/resources/main.rc", "w") + + # rc.write("\n") + # rc.write("/////////////////////////////////////////////////////////////////////////////\n") + # rc.write("// Version\n") + # rc.write("/////////////////////////////////////////////////////////////////////////////\n") + # rc.write("VS_VERSION_INFO VERSIONINFO\n") + # rc.write("FILEVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") + # rc.write("PRODUCTVERSION " + config['MAJOR_STR'] + "," + config['MINOR_STR'] + "," + config['BUGFIX_STR'] + ",0\n") + # rc.write(" FILEFLAGSMASK 0x3fL\n") + # rc.write("#ifdef _DEBUG\n") + # rc.write(" FILEFLAGS 0x1L\n") + # rc.write("#else\n") + # rc.write(" FILEFLAGS 0x0L\n") + # rc.write("#endif\n") + # rc.write(" FILEOS 0x40004L\n") + # rc.write(" FILETYPE 0x1L\n") + # rc.write(" FILESUBTYPE 0x0L\n") + # rc.write("BEGIN\n") + # rc.write(' BLOCK "StringFileInfo"\n') + # rc.write(" BEGIN\n") + # rc.write(' BLOCK "040004e4"\n') + # rc.write(" BEGIN\n") + # rc.write(' VALUE "FileVersion", "' + config['FULL_VER_STR'] + '"\0\n') + # rc.write(' VALUE "ProductVersion", "' + config['FULL_VER_STR'] + '"0\n') + # rc.write("#ifdef VST2_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.dll"\0\n') + # rc.write("#elif defined VST3_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.vst3"\0\n') + # rc.write("#elif defined AAX_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.aaxplugin"\0\n') + # rc.write("#elif defined APP_API\n") + # rc.write(' VALUE "OriginalFilename", "' + config['BUNDLE_NAME'] + '.exe"\0\n') + # rc.write("#endif\n") + # rc.write(' VALUE "FileDescription", "' + config['PLUG_NAME'] + '"\0\n') + # rc.write(' VALUE "InternalName", "' + config['PLUG_NAME'] + '"\0\n') + # rc.write(' VALUE "ProductName", "' + config['PLUG_NAME'] + '"\0\n') + # rc.write(' VALUE "CompanyName", "' + config['PLUG_MFR'] + '"\0\n') + # rc.write(' VALUE "LegalCopyright", "' + config['PLUG_COPYRIGHT_STR'] + '"\0\n') + # rc.write(' VALUE "LegalTrademarks", "' + config['PLUG_TRADEMARKS'] + '"\0\n') + # rc.write(" END\n") + # rc.write(" END\n") + # rc.write(' BLOCK "VarFileInfo"\n') + # rc.write(" BEGIN\n") + # rc.write(' VALUE "Translation", 0x400, 1252\n') + # rc.write(" END\n") + # rc.write("END\n") + # rc.write("\n") + -if __name__ == '__main__': - main() +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/update_installer-win.py b/TemplateProject/scripts/update_installer-win.py @@ -3,66 +3,71 @@ # this script will update the version and text in the innosetup installer files, based on config.h and demo 1/0 import plistlib, os, datetime, fileinput, glob, sys, string + scriptpath = os.path.dirname(os.path.realpath(__file__)) projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) IPLUG2_ROOT = "../../iPlug2" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config + def replacestrs(filename, s, r): - files = glob.glob(filename) - - for line in fileinput.input(files,inplace=1): - string.find(line, s) - line = line.replace(s, r) - sys.stdout.write(line) + files = glob.glob(filename) + + for line in fileinput.input(files, inplace=1): + string.find(line, s) + line = line.replace(s, r) + sys.stdout.write(line) + def main(): - demo = 0 - - if len(sys.argv) != 2: - print("Usage: update_installer_version.py demo(0 or 1)") - sys.exit(1) - else: - demo=int(sys.argv[1]) - - config = parse_config(projectpath) - -# WIN INSTALLER - print("Updating Windows Installer version info...") - - for line in fileinput.input(projectpath + "/installer/" + config['BUNDLE_NAME'] + ".iss",inplace=1): - if "AppVersion" in line: - line="AppVersion=" + config['FULL_VER_STR'] + "\n" - if "OutputBaseFilename" in line: - if demo: - line="OutputBaseFilename=TemplateProject Demo Installer\n" - else: - line="OutputBaseFilename=TemplateProject Installer\n" - - if 'Source: "readme' in line: - if demo: - line='Source: "readme-win-demo.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' - else: - line='Source: "readme-win.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' - - if "WelcomeLabel1" in line: - if demo: - line="WelcomeLabel1=Welcome to the TemplateProject Demo installer\n" - else: - line="WelcomeLabel1=Welcome to the TemplateProject installer\n" - - if "SetupWindowTitle" in line: - if demo: - line="SetupWindowTitle=TemplateProject Demo installer\n" - else: - line="SetupWindowTitle=TemplateProject installer\n" - - sys.stdout.write(line) - - -if __name__ == '__main__': - main() + demo = 0 + + if len(sys.argv) != 2: + print("Usage: update_installer_version.py demo(0 or 1)") + sys.exit(1) + else: + demo = int(sys.argv[1]) + + config = parse_config(projectpath) + + # WIN INSTALLER + print("Updating Windows Installer version info...") + + for line in fileinput.input( + projectpath + "/installer/" + config["BUNDLE_NAME"] + ".iss", inplace=1 + ): + if "AppVersion" in line: + line = "AppVersion=" + config["FULL_VER_STR"] + "\n" + if "OutputBaseFilename" in line: + if demo: + line = "OutputBaseFilename=TemplateProject Demo Installer\n" + else: + line = "OutputBaseFilename=TemplateProject Installer\n" + + if 'Source: "readme' in line: + if demo: + line = 'Source: "readme-win-demo.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' + else: + line = 'Source: "readme-win.rtf"; DestDir: "{app}"; DestName: "readme.rtf"; Flags: isreadme\n' + + if "WelcomeLabel1" in line: + if demo: + line = "WelcomeLabel1=Welcome to the TemplateProject Demo installer\n" + else: + line = "WelcomeLabel1=Welcome to the TemplateProject installer\n" + + if "SetupWindowTitle" in line: + if demo: + line = "SetupWindowTitle=TemplateProject Demo installer\n" + else: + line = "SetupWindowTitle=TemplateProject installer\n" + + sys.stdout.write(line) + + +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/update_version-ios.py b/TemplateProject/scripts/update_version-ios.py @@ -9,101 +9,148 @@ IPLUG2_ROOT = "../../iPlug2" scriptpath = os.path.dirname(os.path.realpath(__file__)) projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) -kAudioUnitType_MusicDevice = "aumu" -kAudioUnitType_MusicEffect = "aumf" -kAudioUnitType_Effect = "aufx" -kAudioUnitType_MIDIProcessor = "aumi" +kAudioUnitType_MusicDevice = "aumu" +kAudioUnitType_MusicEffect = "aumf" +kAudioUnitType_Effect = "aufx" +kAudioUnitType_MIDIProcessor = "aumi" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config, parse_xcconfig -def main(): - config = parse_config(projectpath) - xcconfig = parse_xcconfig(os.path.join(os.getcwd(), IPLUG2_ROOT + '/../common-ios.xcconfig')) - - CFBundleGetInfoString = config['BUNDLE_NAME'] + " v" + config['FULL_VER_STR'] + " " + config['PLUG_COPYRIGHT_STR'] - CFBundleVersion = config['FULL_VER_STR'] - CFBundlePackageType = "BNDL" - CSResourcesFileMapped = True - LSMinimumSystemVersion = xcconfig['DEPLOYMENT_TARGET'] - - print("Processing Info.plist files...") - -# AUDIOUNIT v3 - if config['PLUG_TYPE'] == 0: - if config['PLUG_DOES_MIDI_IN']: - COMPONENT_TYPE = kAudioUnitType_MusicEffect - else: - COMPONENT_TYPE = kAudioUnitType_Effect - elif config['PLUG_TYPE'] == 1: - COMPONENT_TYPE = kAudioUnitType_MusicDevice - elif config['PLUG_TYPE'] == 2: - COMPONENT_TYPE = kAudioUnitType_MIDIProcessor - - if config['PLUG_HAS_UI'] == 1: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" - else: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-iOS-AUv3-Info.plist" - - NSEXTENSIONATTRDICT = dict( - NSExtensionAttributes = dict(AudioComponents = [{}]), - NSExtensionPointIdentifier = NSEXTENSIONPOINTIDENTIFIER - ) - - with open(plistpath, 'rb') as f: - auv3 = plistlib.load(f) - auv3['CFBundleExecutable'] = config['BUNDLE_NAME'] + "AppExtension" - auv3['CFBundleIdentifier'] = "$(PRODUCT_BUNDLE_IDENTIFIER)" - auv3['CFBundleName'] = config['BUNDLE_NAME'] + "AppExtension" - auv3['CFBundleDisplayName'] = config['BUNDLE_NAME'] + "AppExtension" - auv3['CFBundleVersion'] = CFBundleVersion - auv3['CFBundleShortVersionString'] = CFBundleVersion - auv3['CFBundlePackageType'] = "XPC!" - auv3['NSExtension'] = NSEXTENSIONATTRDICT - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'] = [{}] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['description'] = config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['manufacturer'] = config['PLUG_MFR_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['name'] = config['PLUG_MFR'] + ": " + config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['subtype'] = config['PLUG_UNIQUE_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['type'] = COMPONENT_TYPE - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['version'] = config['PLUG_VERSION_INT'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['sandboxSafe'] = True - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'] = ["",""] - - if config['PLUG_TYPE'] == 1: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Synth" - else: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Effects" - - if config['PLUG_HAS_UI'] == 1: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][1] = "size:{" + str(config['PLUG_WIDTH']) + "," + str(config['PLUG_HEIGHT']) + "}" - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['factoryFunction'] = "IPlugAUViewController_vTemplateProject" - auv3['NSExtension']['NSExtensionMainStoryboard'] = config['BUNDLE_NAME'] + "-iOS-MainInterface" +def main(): + config = parse_config(projectpath) + xcconfig = parse_xcconfig( + os.path.join(os.getcwd(), IPLUG2_ROOT + "/../common-ios.xcconfig") + ) + + CFBundleGetInfoString = ( + config["BUNDLE_NAME"] + + " v" + + config["FULL_VER_STR"] + + " " + + config["PLUG_COPYRIGHT_STR"] + ) + CFBundleVersion = config["FULL_VER_STR"] + CFBundlePackageType = "BNDL" + CSResourcesFileMapped = True + LSMinimumSystemVersion = xcconfig["DEPLOYMENT_TARGET"] + + print("Processing Info.plist files...") + + # AUDIOUNIT v3 + + if config["PLUG_TYPE"] == 0: + if config["PLUG_DOES_MIDI_IN"]: + COMPONENT_TYPE = kAudioUnitType_MusicEffect + else: + COMPONENT_TYPE = kAudioUnitType_Effect + elif config["PLUG_TYPE"] == 1: + COMPONENT_TYPE = kAudioUnitType_MusicDevice + elif config["PLUG_TYPE"] == 2: + COMPONENT_TYPE = kAudioUnitType_MIDIProcessor + + if config["PLUG_HAS_UI"] == 1: + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" else: - auv3['NSExtension']['NSExtensionPrincipalClass'] = "IPlugAUViewController_vTemplateProject" - - with open(plistpath, 'wb') as f2: - plistlib.dump(auv3, f2) - -# Standalone APP - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-iOS-Info.plist" - with open(plistpath, 'rb') as f: - iOSapp = plistlib.load(f) - iOSapp['CFBundleExecutable'] = config['BUNDLE_NAME'] - iOSapp['CFBundleIdentifier'] = "$(PRODUCT_BUNDLE_IDENTIFIER)" - iOSapp['CFBundleName'] = config['BUNDLE_NAME'] - iOSapp['CFBundleVersion'] = CFBundleVersion - iOSapp['CFBundleShortVersionString'] = CFBundleVersion - iOSapp['CFBundlePackageType'] = "APPL" - iOSapp['LSApplicationCategoryType'] = "public.app-category.music" - - with open(plistpath, 'wb') as f2: - plistlib.dump(iOSapp, f2) - -if __name__ == '__main__': - main() + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" + + plistpath = ( + projectpath + "/resources/" + config["BUNDLE_NAME"] + "-iOS-AUv3-Info.plist" + ) + + NSEXTENSIONATTRDICT = dict( + NSExtensionAttributes=dict(AudioComponents=[{}]), + NSExtensionPointIdentifier=NSEXTENSIONPOINTIDENTIFIER, + ) + + with open(plistpath, "rb") as f: + auv3 = plistlib.load(f) + auv3["CFBundleExecutable"] = config["BUNDLE_NAME"] + "AppExtension" + auv3["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)" + auv3["CFBundleName"] = config["BUNDLE_NAME"] + "AppExtension" + auv3["CFBundleDisplayName"] = config["BUNDLE_NAME"] + "AppExtension" + auv3["CFBundleVersion"] = CFBundleVersion + auv3["CFBundleShortVersionString"] = CFBundleVersion + auv3["CFBundlePackageType"] = "XPC!" + auv3["NSExtension"] = NSEXTENSIONATTRDICT + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"] = [{}] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "description" + ] = config["PLUG_NAME"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "manufacturer" + ] = config["PLUG_MFR_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["name"] = ( + config["PLUG_MFR"] + ": " + config["PLUG_NAME"] + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "subtype" + ] = config["PLUG_UNIQUE_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "type" + ] = COMPONENT_TYPE + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "version" + ] = config["PLUG_VERSION_INT"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "sandboxSafe" + ] = True + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"] = [ + "", + "", + ] + + if config["PLUG_TYPE"] == 1: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Synth" + else: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Effects" + + if config["PLUG_HAS_UI"] == 1: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 1 + ] = ( + "size:{" + + str(config["PLUG_WIDTH"]) + + "," + + str(config["PLUG_HEIGHT"]) + + "}" + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "factoryFunction" + ] = "IPlugAUViewController_vTemplateProject" + auv3["NSExtension"]["NSExtensionMainStoryboard"] = ( + config["BUNDLE_NAME"] + "-iOS-MainInterface" + ) + else: + auv3["NSExtension"][ + "NSExtensionPrincipalClass" + ] = "IPlugAUViewController_vTemplateProject" + + with open(plistpath, "wb") as f2: + plistlib.dump(auv3, f2) + + # Standalone APP + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-iOS-Info.plist" + with open(plistpath, "rb") as f: + iOSapp = plistlib.load(f) + iOSapp["CFBundleExecutable"] = config["BUNDLE_NAME"] + iOSapp["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)" + iOSapp["CFBundleName"] = config["BUNDLE_NAME"] + iOSapp["CFBundleVersion"] = CFBundleVersion + iOSapp["CFBundleShortVersionString"] = CFBundleVersion + iOSapp["CFBundlePackageType"] = "APPL" + iOSapp["LSApplicationCategoryType"] = "public.app-category.music" + + with open(plistpath, "wb") as f2: + plistlib.dump(iOSapp, f2) + + +if __name__ == "__main__": + main() diff --git a/TemplateProject/scripts/update_version-mac.py b/TemplateProject/scripts/update_version-mac.py @@ -9,190 +9,273 @@ IPLUG2_ROOT = "../../iPlug2" scriptpath = os.path.dirname(os.path.realpath(__file__)) projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) -kAudioUnitType_MusicDevice = "aumu" -kAudioUnitType_MusicEffect = "aumf" -kAudioUnitType_Effect = "aufx" -kAudioUnitType_MIDIProcessor = "aumi" +kAudioUnitType_MusicDevice = "aumu" +kAudioUnitType_MusicEffect = "aumf" +kAudioUnitType_Effect = "aufx" +kAudioUnitType_MIDIProcessor = "aumi" -sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + '/Scripts')) +sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) from parse_config import parse_config, parse_xcconfig + def main(): - config = parse_config(projectpath) - xcconfig = parse_xcconfig(os.path.join(os.getcwd(), IPLUG2_ROOT + '/../common-mac.xcconfig')) - - CFBundleGetInfoString = config['BUNDLE_NAME'] + " v" + config['FULL_VER_STR'] + " " + config['PLUG_COPYRIGHT_STR'] - CFBundleVersion = config['FULL_VER_STR'] - CFBundlePackageType = "BNDL" - CSResourcesFileMapped = True - LSMinimumSystemVersion = xcconfig['DEPLOYMENT_TARGET'] - - print("Processing Info.plist files...") - -# VST3 - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-VST3-Info.plist" - with open(plistpath, 'rb') as f: - vst3 = plistlib.load(f) - vst3['CFBundleExecutable'] = config['BUNDLE_NAME'] - vst3['CFBundleGetInfoString'] = CFBundleGetInfoString - vst3['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".vst3." + config['BUNDLE_NAME'] + "" - vst3['CFBundleName'] = config['BUNDLE_NAME'] - vst3['CFBundleVersion'] = CFBundleVersion - vst3['CFBundleShortVersionString'] = CFBundleVersion - vst3['LSMinimumSystemVersion'] = LSMinimumSystemVersion - vst3['CFBundlePackageType'] = CFBundlePackageType - vst3['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - vst3['CSResourcesFileMapped'] = CSResourcesFileMapped - - with open(plistpath, 'wb') as f2: - plistlib.dump(vst3, f2) - -# VST2 - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-VST2-Info.plist" - with open(plistpath, 'rb') as f: - vst2 = plistlib.load(f) - vst2['CFBundleExecutable'] = config['BUNDLE_NAME'] - vst2['CFBundleGetInfoString'] = CFBundleGetInfoString - vst2['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".vst." + config['BUNDLE_NAME'] + "" - vst2['CFBundleName'] = config['BUNDLE_NAME'] - vst2['CFBundleVersion'] = CFBundleVersion - vst2['CFBundleShortVersionString'] = CFBundleVersion - vst2['LSMinimumSystemVersion'] = LSMinimumSystemVersion - vst2['CFBundlePackageType'] = CFBundlePackageType - vst2['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - vst2['CSResourcesFileMapped'] = CSResourcesFileMapped - - with open(plistpath, 'wb') as f2: - plistlib.dump(vst2, f2) - -# AUDIOUNIT v2 - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-AU-Info.plist" - with open(plistpath, 'rb') as f: - auv2 = plistlib.load(f) - auv2['CFBundleExecutable'] = config['BUNDLE_NAME'] - auv2['CFBundleGetInfoString'] = CFBundleGetInfoString - auv2['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".audiounit." + config['BUNDLE_NAME'] + "" - auv2['CFBundleName'] = config['BUNDLE_NAME'] - auv2['CFBundleVersion'] = CFBundleVersion - auv2['CFBundleShortVersionString'] = CFBundleVersion - auv2['LSMinimumSystemVersion'] = LSMinimumSystemVersion - auv2['CFBundlePackageType'] = CFBundlePackageType - auv2['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - auv2['CSResourcesFileMapped'] = CSResourcesFileMapped - - if config['PLUG_TYPE'] == 0: - if config['PLUG_DOES_MIDI_IN']: - COMPONENT_TYPE = kAudioUnitType_MusicEffect - else: - COMPONENT_TYPE = kAudioUnitType_Effect - elif config['PLUG_TYPE'] == 1: - COMPONENT_TYPE = kAudioUnitType_MusicDevice - elif config['PLUG_TYPE'] == 2: - COMPONENT_TYPE = kAudioUnitType_MIDIProcessor - - auv2['AudioUnit Version'] = config['PLUG_VERSION_HEX'] - auv2['AudioComponents'] = [{}] - auv2['AudioComponents'][0]['description'] = config['PLUG_NAME'] - auv2['AudioComponents'][0]['factoryFunction'] = config['AUV2_FACTORY'] - auv2['AudioComponents'][0]['manufacturer'] = config['PLUG_MFR_ID'] - auv2['AudioComponents'][0]['name'] = config['PLUG_MFR'] + ": " + config['PLUG_NAME'] - auv2['AudioComponents'][0]['subtype'] = config['PLUG_UNIQUE_ID'] - auv2['AudioComponents'][0]['type'] = COMPONENT_TYPE - auv2['AudioComponents'][0]['version'] = config['PLUG_VERSION_INT'] - auv2['AudioComponents'][0]['sandboxSafe'] = True - - with open(plistpath, 'wb') as f2: - plistlib.dump(auv2, f2) - -# AUDIOUNIT v3 - - if config['PLUG_HAS_UI']: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" - else: - NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-macOS-AUv3-Info.plist" - - with open(plistpath, 'rb') as f: - auv3 = plistlib.load(f) - auv3['CFBundleExecutable'] = config['BUNDLE_NAME'] - auv3['CFBundleGetInfoString'] = CFBundleGetInfoString - auv3['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".app." + config['BUNDLE_NAME'] + ".AUv3" - auv3['CFBundleName'] = config['BUNDLE_NAME'] - auv3['CFBundleVersion'] = CFBundleVersion - auv3['CFBundleShortVersionString'] = CFBundleVersion - auv3['LSMinimumSystemVersion'] = "10.12.0" - auv3['CFBundlePackageType'] = "XPC!" - auv3['NSExtension'] = dict( - NSExtensionAttributes = dict( - AudioComponentBundle = "com.AcmeInc.app." + config['BUNDLE_NAME'] + ".AUv3Framework", - AudioComponents = [{}]), - # NSExtensionServiceRoleType = "NSExtensionServiceRoleTypeEditor", - NSExtensionPointIdentifier = NSEXTENSIONPOINTIDENTIFIER, - NSExtensionPrincipalClass = "IPlugAUViewController_vTemplateProject" - ) - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'] = [{}] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['description'] = config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['manufacturer'] = config['PLUG_MFR_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['name'] = config['PLUG_MFR'] + ": " + config['PLUG_NAME'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['subtype'] = config['PLUG_UNIQUE_ID'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['type'] = COMPONENT_TYPE - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['version'] = config['PLUG_VERSION_INT'] - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['sandboxSafe'] = True - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'] = [{}] - - if config['PLUG_TYPE'] == 1: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Synth" + config = parse_config(projectpath) + xcconfig = parse_xcconfig( + os.path.join(os.getcwd(), IPLUG2_ROOT + "/../common-mac.xcconfig") + ) + + CFBundleGetInfoString = ( + config["BUNDLE_NAME"] + + " v" + + config["FULL_VER_STR"] + + " " + + config["PLUG_COPYRIGHT_STR"] + ) + CFBundleVersion = config["FULL_VER_STR"] + CFBundlePackageType = "BNDL" + CSResourcesFileMapped = True + LSMinimumSystemVersion = xcconfig["DEPLOYMENT_TARGET"] + + print("Processing Info.plist files...") + + # VST3 + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-VST3-Info.plist" + with open(plistpath, "rb") as f: + vst3 = plistlib.load(f) + vst3["CFBundleExecutable"] = config["BUNDLE_NAME"] + vst3["CFBundleGetInfoString"] = CFBundleGetInfoString + vst3["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".vst3." + + config["BUNDLE_NAME"] + + "" + ) + vst3["CFBundleName"] = config["BUNDLE_NAME"] + vst3["CFBundleVersion"] = CFBundleVersion + vst3["CFBundleShortVersionString"] = CFBundleVersion + vst3["LSMinimumSystemVersion"] = LSMinimumSystemVersion + vst3["CFBundlePackageType"] = CFBundlePackageType + vst3["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + vst3["CSResourcesFileMapped"] = CSResourcesFileMapped + + with open(plistpath, "wb") as f2: + plistlib.dump(vst3, f2) + + # VST2 + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-VST2-Info.plist" + with open(plistpath, "rb") as f: + vst2 = plistlib.load(f) + vst2["CFBundleExecutable"] = config["BUNDLE_NAME"] + vst2["CFBundleGetInfoString"] = CFBundleGetInfoString + vst2["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".vst." + + config["BUNDLE_NAME"] + + "" + ) + vst2["CFBundleName"] = config["BUNDLE_NAME"] + vst2["CFBundleVersion"] = CFBundleVersion + vst2["CFBundleShortVersionString"] = CFBundleVersion + vst2["LSMinimumSystemVersion"] = LSMinimumSystemVersion + vst2["CFBundlePackageType"] = CFBundlePackageType + vst2["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + vst2["CSResourcesFileMapped"] = CSResourcesFileMapped + + with open(plistpath, "wb") as f2: + plistlib.dump(vst2, f2) + + # AUDIOUNIT v2 + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-AU-Info.plist" + with open(plistpath, "rb") as f: + auv2 = plistlib.load(f) + auv2["CFBundleExecutable"] = config["BUNDLE_NAME"] + auv2["CFBundleGetInfoString"] = CFBundleGetInfoString + auv2["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".audiounit." + + config["BUNDLE_NAME"] + + "" + ) + auv2["CFBundleName"] = config["BUNDLE_NAME"] + auv2["CFBundleVersion"] = CFBundleVersion + auv2["CFBundleShortVersionString"] = CFBundleVersion + auv2["LSMinimumSystemVersion"] = LSMinimumSystemVersion + auv2["CFBundlePackageType"] = CFBundlePackageType + auv2["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + auv2["CSResourcesFileMapped"] = CSResourcesFileMapped + + if config["PLUG_TYPE"] == 0: + if config["PLUG_DOES_MIDI_IN"]: + COMPONENT_TYPE = kAudioUnitType_MusicEffect + else: + COMPONENT_TYPE = kAudioUnitType_Effect + elif config["PLUG_TYPE"] == 1: + COMPONENT_TYPE = kAudioUnitType_MusicDevice + elif config["PLUG_TYPE"] == 2: + COMPONENT_TYPE = kAudioUnitType_MIDIProcessor + + auv2["AudioUnit Version"] = config["PLUG_VERSION_HEX"] + auv2["AudioComponents"] = [{}] + auv2["AudioComponents"][0]["description"] = config["PLUG_NAME"] + auv2["AudioComponents"][0]["factoryFunction"] = config["AUV2_FACTORY"] + auv2["AudioComponents"][0]["manufacturer"] = config["PLUG_MFR_ID"] + auv2["AudioComponents"][0]["name"] = ( + config["PLUG_MFR"] + ": " + config["PLUG_NAME"] + ) + auv2["AudioComponents"][0]["subtype"] = config["PLUG_UNIQUE_ID"] + auv2["AudioComponents"][0]["type"] = COMPONENT_TYPE + auv2["AudioComponents"][0]["version"] = config["PLUG_VERSION_INT"] + auv2["AudioComponents"][0]["sandboxSafe"] = True + + with open(plistpath, "wb") as f2: + plistlib.dump(auv2, f2) + + # AUDIOUNIT v3 + + if config["PLUG_HAS_UI"]: + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" else: - auv3['NSExtension']['NSExtensionAttributes']['AudioComponents'][0]['tags'][0] = "Effects" - - with open(plistpath, 'wb') as f2: - plistlib.dump(auv3, f2) - -# AAX - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-AAX-Info.plist" - with open(plistpath, 'rb') as f: - aax = plistlib.load(f) - aax['CFBundleExecutable'] = config['BUNDLE_NAME'] - aax['CFBundleGetInfoString'] = CFBundleGetInfoString - aax['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".aax." + config['BUNDLE_NAME'] + "" - aax['CFBundleName'] = config['BUNDLE_NAME'] - aax['CFBundleVersion'] = CFBundleVersion - aax['CFBundleShortVersionString'] = CFBundleVersion - aax['LSMinimumSystemVersion'] = LSMinimumSystemVersion - aax['CSResourcesFileMapped'] = CSResourcesFileMapped - - with open(plistpath, 'wb') as f2: - plistlib.dump(aax, f2) - -# APP - - plistpath = projectpath + "/resources/" + config['BUNDLE_NAME'] + "-macOS-Info.plist" - - with open(plistpath, 'rb') as f: - macOSapp = plistlib.load(f) - macOSapp['CFBundleExecutable'] = config['BUNDLE_NAME'] - macOSapp['CFBundleGetInfoString'] = CFBundleGetInfoString - macOSapp['CFBundleIdentifier'] = config['BUNDLE_DOMAIN'] + "." + config['BUNDLE_MFR'] + ".app." + config['BUNDLE_NAME'] + "" - macOSapp['CFBundleName'] = config['BUNDLE_NAME'] - macOSapp['CFBundleVersion'] = CFBundleVersion - macOSapp['CFBundleShortVersionString'] = CFBundleVersion - macOSapp['LSMinimumSystemVersion'] = LSMinimumSystemVersion - macOSapp['CFBundlePackageType'] = CFBundlePackageType - macOSapp['CFBundleSignature'] = config['PLUG_UNIQUE_ID'] - macOSapp['CSResourcesFileMapped'] = CSResourcesFileMapped - macOSapp['NSPrincipalClass'] = "SWELLApplication" - macOSapp['NSMainNibFile'] = config['BUNDLE_NAME'] + "-macOS-MainMenu" - macOSapp['LSApplicationCategoryType'] = "public.app-category.music" - macOSapp['NSMicrophoneUsageDescription'] = "This app needs mic access to process audio." - - with open(plistpath, 'wb') as f2: - plistlib.dump(macOSapp, f2) - -if __name__ == '__main__': - main() + NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" + + plistpath = ( + projectpath + "/resources/" + config["BUNDLE_NAME"] + "-macOS-AUv3-Info.plist" + ) + + with open(plistpath, "rb") as f: + auv3 = plistlib.load(f) + auv3["CFBundleExecutable"] = config["BUNDLE_NAME"] + auv3["CFBundleGetInfoString"] = CFBundleGetInfoString + auv3["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".app." + + config["BUNDLE_NAME"] + + ".AUv3" + ) + auv3["CFBundleName"] = config["BUNDLE_NAME"] + auv3["CFBundleVersion"] = CFBundleVersion + auv3["CFBundleShortVersionString"] = CFBundleVersion + auv3["LSMinimumSystemVersion"] = "10.12.0" + auv3["CFBundlePackageType"] = "XPC!" + auv3["NSExtension"] = dict( + NSExtensionAttributes=dict( + AudioComponentBundle="com.AcmeInc.app." + + config["BUNDLE_NAME"] + + ".AUv3Framework", + AudioComponents=[{}], + ), + # NSExtensionServiceRoleType = "NSExtensionServiceRoleTypeEditor", + NSExtensionPointIdentifier=NSEXTENSIONPOINTIDENTIFIER, + NSExtensionPrincipalClass="IPlugAUViewController_vTemplateProject", + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"] = [{}] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "description" + ] = config["PLUG_NAME"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "manufacturer" + ] = config["PLUG_MFR_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["name"] = ( + config["PLUG_MFR"] + ": " + config["PLUG_NAME"] + ) + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "subtype" + ] = config["PLUG_UNIQUE_ID"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "type" + ] = COMPONENT_TYPE + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "version" + ] = config["PLUG_VERSION_INT"] + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ + "sandboxSafe" + ] = True + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"] = [ + {} + ] + + if config["PLUG_TYPE"] == 1: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Synth" + else: + auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ + 0 + ] = "Effects" + + with open(plistpath, "wb") as f2: + plistlib.dump(auv3, f2) + + # AAX + + plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-AAX-Info.plist" + with open(plistpath, "rb") as f: + aax = plistlib.load(f) + aax["CFBundleExecutable"] = config["BUNDLE_NAME"] + aax["CFBundleGetInfoString"] = CFBundleGetInfoString + aax["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".aax." + + config["BUNDLE_NAME"] + + "" + ) + aax["CFBundleName"] = config["BUNDLE_NAME"] + aax["CFBundleVersion"] = CFBundleVersion + aax["CFBundleShortVersionString"] = CFBundleVersion + aax["LSMinimumSystemVersion"] = LSMinimumSystemVersion + aax["CSResourcesFileMapped"] = CSResourcesFileMapped + + with open(plistpath, "wb") as f2: + plistlib.dump(aax, f2) + + # APP + + plistpath = ( + projectpath + "/resources/" + config["BUNDLE_NAME"] + "-macOS-Info.plist" + ) + + with open(plistpath, "rb") as f: + macOSapp = plistlib.load(f) + macOSapp["CFBundleExecutable"] = config["BUNDLE_NAME"] + macOSapp["CFBundleGetInfoString"] = CFBundleGetInfoString + macOSapp["CFBundleIdentifier"] = ( + config["BUNDLE_DOMAIN"] + + "." + + config["BUNDLE_MFR"] + + ".app." + + config["BUNDLE_NAME"] + + "" + ) + macOSapp["CFBundleName"] = config["BUNDLE_NAME"] + macOSapp["CFBundleVersion"] = CFBundleVersion + macOSapp["CFBundleShortVersionString"] = CFBundleVersion + macOSapp["LSMinimumSystemVersion"] = LSMinimumSystemVersion + macOSapp["CFBundlePackageType"] = CFBundlePackageType + macOSapp["CFBundleSignature"] = config["PLUG_UNIQUE_ID"] + macOSapp["CSResourcesFileMapped"] = CSResourcesFileMapped + macOSapp["NSPrincipalClass"] = "SWELLApplication" + macOSapp["NSMainNibFile"] = config["BUNDLE_NAME"] + "-macOS-MainMenu" + macOSapp["LSApplicationCategoryType"] = "public.app-category.music" + macOSapp[ + "NSMicrophoneUsageDescription" + ] = "This app needs mic access to process audio." + + with open(plistpath, "wb") as f2: + plistlib.dump(macOSapp, f2) + + +if __name__ == "__main__": + main() diff --git a/bump_version.py b/bump_version.py @@ -81,9 +81,7 @@ def main(): print("\n\n--------------------") tagname = f"v{newVersionInfo}" - remove_tag = input( - f"\nAttempt to remove existing tag for {tagname}? Y/N: " - ) + remove_tag = input(f"\nAttempt to remove existing tag for {tagname}? Y/N: ") if remove_tag == "y" or remove_tag == "Y": os.system(f"git tag -d {tagname}") diff --git a/duplicate.py b/duplicate.py @@ -30,239 +30,370 @@ from os.path import join scriptpath = os.path.dirname(os.path.realpath(__file__)) -sys.path.insert(0, scriptpath + '/iPlug2/Scripts/') +sys.path.insert(0, scriptpath + "/iPlug2/Scripts/") from parse_config import parse_config, parse_xcconfig, set_uniqueid VERSION = "0.95" # binary files that we don't want to do find and replace inside -FILTERED_FILE_EXTENSIONS = [".ico",".icns", ".pdf", ".png", ".zip", ".exe", ".wav", ".aif", ".data", ".wasm", "mkcert"] +FILTERED_FILE_EXTENSIONS = [ + ".ico", + ".icns", + ".pdf", + ".png", + ".zip", + ".exe", + ".wav", + ".aif", + ".data", + ".wasm", + "mkcert", +] FILTERED_FILE_NAMES = [".DS_Store"] # files that we don't want to duplicate -DONT_COPY = (".vs", "*.exe", "*.dmg", "*.pkg", "*.mpkg", "*.svn", "*.ncb", "*.suo", "*sdf", "ipch", "*.layout", "*.depend", ".DS_Store", "xcuserdata", "*.aps") +DONT_COPY = ( + ".vs", + "*.exe", + "*.dmg", + "*.pkg", + "*.mpkg", + "*.svn", + "*.ncb", + "*.suo", + "*sdf", + "ipch", + "*.layout", + "*.depend", + ".DS_Store", + "xcuserdata", + "*.aps", +) SUBFOLDERS_TO_SEARCH = [ -"projects", -"config", -"resources", -"installer", -"scripts", -"manual", -"xcschemes", -"xcshareddata", -"xcuserdata", -"en-osx.lproj", -"project.xcworkspace", -"Images.xcassets", -"build-web" + "projects", + "config", + "resources", + "installer", + "scripts", + "manual", + "xcschemes", + "xcshareddata", + "xcuserdata", + "en-osx.lproj", + "project.xcworkspace", + "Images.xcassets", + "build-web", ] + def randomFourChar(chars=string.ascii_letters + string.digits): - return ''.join(random.choice(chars) for _ in range(4)) + return "".join(random.choice(chars) for _ in range(4)) + def checkdirname(name, searchproject): - "check if directory name matches with the given pattern" - print("") - if name == searchproject: - return True - else: - return False + "check if directory name matches with the given pattern" + print("") + if name == searchproject: + return True + else: + return False + def replacestrs(filename, s, r): - files = glob.glob(filename) + files = glob.glob(filename) + + for line in fileinput.input(files, inplace=1): + line.find(s) + line = line.replace(s, r) + sys.stdout.write(line) - for line in fileinput.input(files,inplace=1): - line.find(s) - line = line.replace(s, r) - sys.stdout.write(line) def replacestrsChop(filename, s, r): - files = glob.glob(filename) - - for line in fileinput.input(files,inplace=1): - if(line.startswith(s)): - line = r + "\n" - sys.stdout.write(line) - -def dirwalk(dir, searchproject, replaceproject, searchman, replaceman, oldroot= "", newroot=""): - for f in os.listdir(dir): - fullpath = os.path.join(dir, f) - - if os.path.isdir(fullpath) and not os.path.islink(fullpath): - if checkdirname(f, searchproject + "-macOS.xcodeproj"): - os.rename(fullpath, os.path.join(dir, replaceproject + "-macOS.xcodeproj")) - fullpath = os.path.join(dir, replaceproject + "-macOS.xcodeproj") - - print("recursing in macOS xcode project directory: ") - for x in dirwalk(fullpath, searchproject, replaceproject, searchman, replaceman, oldroot, newroot): - yield x - elif checkdirname(f, searchproject + "-iOS.xcodeproj"): - os.rename(fullpath, os.path.join(dir, replaceproject + "-iOS.xcodeproj")) - fullpath = os.path.join(dir, replaceproject + "-iOS.xcodeproj") - - print("recursing in iOS xcode project directory: ") - for x in dirwalk(fullpath, searchproject, replaceproject, searchman, replaceman, oldroot, newroot): - yield x - elif checkdirname(f, searchproject + ".xcworkspace"): - os.rename(fullpath, os.path.join(dir, replaceproject + ".xcworkspace")) - fullpath = os.path.join(dir, replaceproject + ".xcworkspace") - - print("recursing in main xcode workspace directory: ") - for x in dirwalk(fullpath, searchproject, replaceproject, searchman, replaceman, oldroot, newroot): - yield x - elif checkdirname(f, searchproject + "-iOS.appiconset"): - os.rename(fullpath, os.path.join(dir, replaceproject + "-iOS.appiconset")) - fullpath = os.path.join(dir, replaceproject + "-iOS.appiconset") - - print("recursing in -iOS.appiconset directory: ") - elif checkdirname(f, searchproject + "-macOS.appiconset"): - os.rename(fullpath, os.path.join(dir, replaceproject + "-macOS.appiconset")) - fullpath = os.path.join(dir, replaceproject + "-macOS.appiconset") - - print("recursing in -macOS.appiconset directory: ") - for x in dirwalk(fullpath, searchproject, replaceproject, searchman, replaceman, oldroot, newroot): - yield x - elif (f in SUBFOLDERS_TO_SEARCH): - print('recursing in ' + f + ' directory: ') - for x in dirwalk(fullpath, searchproject, replaceproject, searchman, replaceman, oldroot, newroot): - yield x - - if os.path.isfile(fullpath): - filename = os.path.basename(fullpath) - newfilename = filename.replace(searchproject, replaceproject) - base, extension = os.path.splitext(filename) - - if (not(extension in FILTERED_FILE_EXTENSIONS) and not(filename in FILTERED_FILE_NAMES)): - - print("Replacing project name strings in file " + filename) - replacestrs(fullpath, searchproject, replaceproject) - - print("Replacing captitalized project name strings in file " + filename) - replacestrs(fullpath, searchproject.upper(), replaceproject.upper()) - - print("Replacing manufacturer name strings in file " + filename) - replacestrs(fullpath, searchman, replaceman) - - if (oldroot and newroot): - print ("Replacing iPlug2 root folder in file " + filename) - replacestrs(fullpath, oldroot, newroot) - replacestrs(fullpath, oldroot.replace('/', '\\'), newroot.replace('/', '\\')) - - else: - print("NOT replacing name strings in file " + filename) - - if filename != newfilename: - print("Renaming file " + filename + " to " + newfilename) - os.rename(fullpath, os.path.join(dir, newfilename)) - - yield f, fullpath - else: - yield f, fullpath + files = glob.glob(filename) + + for line in fileinput.input(files, inplace=1): + if line.startswith(s): + line = r + "\n" + sys.stdout.write(line) + + +def dirwalk( + dir, searchproject, replaceproject, searchman, replaceman, oldroot="", newroot="" +): + for f in os.listdir(dir): + fullpath = os.path.join(dir, f) + + if os.path.isdir(fullpath) and not os.path.islink(fullpath): + if checkdirname(f, searchproject + "-macOS.xcodeproj"): + os.rename( + fullpath, os.path.join(dir, replaceproject + "-macOS.xcodeproj") + ) + fullpath = os.path.join(dir, replaceproject + "-macOS.xcodeproj") + + print("recursing in macOS xcode project directory: ") + for x in dirwalk( + fullpath, + searchproject, + replaceproject, + searchman, + replaceman, + oldroot, + newroot, + ): + yield x + elif checkdirname(f, searchproject + "-iOS.xcodeproj"): + os.rename( + fullpath, os.path.join(dir, replaceproject + "-iOS.xcodeproj") + ) + fullpath = os.path.join(dir, replaceproject + "-iOS.xcodeproj") + + print("recursing in iOS xcode project directory: ") + for x in dirwalk( + fullpath, + searchproject, + replaceproject, + searchman, + replaceman, + oldroot, + newroot, + ): + yield x + elif checkdirname(f, searchproject + ".xcworkspace"): + os.rename(fullpath, os.path.join(dir, replaceproject + ".xcworkspace")) + fullpath = os.path.join(dir, replaceproject + ".xcworkspace") + + print("recursing in main xcode workspace directory: ") + for x in dirwalk( + fullpath, + searchproject, + replaceproject, + searchman, + replaceman, + oldroot, + newroot, + ): + yield x + elif checkdirname(f, searchproject + "-iOS.appiconset"): + os.rename( + fullpath, os.path.join(dir, replaceproject + "-iOS.appiconset") + ) + fullpath = os.path.join(dir, replaceproject + "-iOS.appiconset") + + print("recursing in -iOS.appiconset directory: ") + elif checkdirname(f, searchproject + "-macOS.appiconset"): + os.rename( + fullpath, os.path.join(dir, replaceproject + "-macOS.appiconset") + ) + fullpath = os.path.join(dir, replaceproject + "-macOS.appiconset") + + print("recursing in -macOS.appiconset directory: ") + for x in dirwalk( + fullpath, + searchproject, + replaceproject, + searchman, + replaceman, + oldroot, + newroot, + ): + yield x + elif f in SUBFOLDERS_TO_SEARCH: + print("recursing in " + f + " directory: ") + for x in dirwalk( + fullpath, + searchproject, + replaceproject, + searchman, + replaceman, + oldroot, + newroot, + ): + yield x + + if os.path.isfile(fullpath): + filename = os.path.basename(fullpath) + newfilename = filename.replace(searchproject, replaceproject) + base, extension = os.path.splitext(filename) + + if not (extension in FILTERED_FILE_EXTENSIONS) and not ( + filename in FILTERED_FILE_NAMES + ): + + print("Replacing project name strings in file " + filename) + replacestrs(fullpath, searchproject, replaceproject) + + print("Replacing captitalized project name strings in file " + filename) + replacestrs(fullpath, searchproject.upper(), replaceproject.upper()) + + print("Replacing manufacturer name strings in file " + filename) + replacestrs(fullpath, searchman, replaceman) + + if oldroot and newroot: + print("Replacing iPlug2 root folder in file " + filename) + replacestrs(fullpath, oldroot, newroot) + replacestrs( + fullpath, oldroot.replace("/", "\\"), newroot.replace("/", "\\") + ) + + else: + print("NOT replacing name strings in file " + filename) + + if filename != newfilename: + print("Renaming file " + filename + " to " + newfilename) + os.rename(fullpath, os.path.join(dir, newfilename)) + + yield f, fullpath + else: + yield f, fullpath + def main(): - global VERSION - print("\nIPlug Project Duplicator v" + VERSION + " by Oli Larkin ------------------------------\n") - - numargs = len(sys.argv) - 1 - - if not (numargs == 3 or numargs == 4): - print("Usage: duplicate.py inputprojectname outputprojectname manufacturername (outputprojectpath)") - sys.exit(1) - else: - inputprojectname=sys.argv[1] - outputprojectname=sys.argv[2] - manufacturer=sys.argv[3] - - if numargs == 4: - outputbasepath=os.path.abspath(sys.argv[4]) - else: - outputbasepath=os.getcwd() - - if not (os.path.isdir(outputbasepath)): - print("error: Output path does not exist") - sys.exit(1) - - outputpath = os.path.join(outputbasepath, outputprojectname) - - if ' ' in inputprojectname: - print("error: input project name has spaces") - sys.exit(1) - - if inputprojectname not in os.listdir(os.curdir): - print("error: input project " + inputprojectname + " doesn't exist, check spelling/case?") - sys.exit(1) - - if ' ' in outputprojectname: - print("error: output project name has spaces") - sys.exit(1) - - if ' ' in manufacturer: - print("error: manufacturer name has spaces") - sys.exit(1) - - # remove a trailing slash if it exists - if inputprojectname[-1:] == "/": - inputprojectname = inputprojectname[0:-1] - - if outputprojectname[-1:] == "/": - outputprojectname = outputprojectname[0:-1] - - #check that the folders are OK - if os.path.isdir(inputprojectname) == False: - print("error: input project not found") - sys.exit(1) - - if os.path.isdir(outputpath): - print("error: output project allready exists") - sys.exit(1) - # rmtree(output) - - print("copying " + inputprojectname + " folder to " + outputpath) - copytree(inputprojectname, outputpath, ignore=ignore_patterns(*DONT_COPY)) - - oldroot = "" - newroot = "" - - if numargs == 4: - configpath = os.path.join(inputprojectname, "config") - xcconfig = parse_xcconfig(configpath + "/" + inputprojectname + "-mac.xcconfig") - oldroot = xcconfig["IPLUG2_ROOT"] - iplug2folder = os.path.abspath(os.path.join(configpath, oldroot)) - newroot = os.path.relpath(iplug2folder, os.path.join(outputpath, "config")) - else: - newroot = "" + global VERSION + print( + "\nIPlug Project Duplicator v" + + VERSION + + " by Oli Larkin ------------------------------\n" + ) + + numargs = len(sys.argv) - 1 + + if not (numargs == 3 or numargs == 4): + print( + "Usage: duplicate.py inputprojectname outputprojectname manufacturername (outputprojectpath)" + ) + sys.exit(1) + else: + inputprojectname = sys.argv[1] + outputprojectname = sys.argv[2] + manufacturer = sys.argv[3] + + if numargs == 4: + outputbasepath = os.path.abspath(sys.argv[4]) + else: + outputbasepath = os.getcwd() - #replace manufacturer name strings - for dir in dirwalk(outputpath, inputprojectname, outputprojectname, "AcmeInc", manufacturer, oldroot, newroot): - pass + if not (os.path.isdir(outputbasepath)): + print("error: Output path does not exist") + sys.exit(1) - #replace project name in root - for dir in dirwalk(scriptpath, inputprojectname, outputprojectname, "AcmeInc", manufacturer, oldroot, newroot): - pass + outputpath = os.path.join(outputbasepath, outputprojectname) - #replace project name in github - for dir in dirwalk(scriptpath + "/.github/workflows", inputprojectname, outputprojectname, "AcmeInc", manufacturer, oldroot, newroot): - pass + if " " in inputprojectname: + print("error: input project name has spaces") + sys.exit(1) - #replace project name in vscode - for dir in dirwalk(scriptpath + "/.vscode", inputprojectname, outputprojectname, "AcmeInc", manufacturer, oldroot, newroot): - pass + if inputprojectname not in os.listdir(os.curdir): + print( + "error: input project " + + inputprojectname + + " doesn't exist, check spelling/case?" + ) + sys.exit(1) - # print("\ncopying gitignore template into project folder\n") + if " " in outputprojectname: + print("error: output project name has spaces") + sys.exit(1) - # copy('gitignore_template', outputpath + "/.gitignore") + if " " in manufacturer: + print("error: manufacturer name has spaces") + sys.exit(1) - config = parse_config(outputpath) + # remove a trailing slash if it exists + if inputprojectname[-1:] == "/": + inputprojectname = inputprojectname[0:-1] - config["PLUG_UNIQUE_ID"] = randomFourChar() + if outputprojectname[-1:] == "/": + outputprojectname = outputprojectname[0:-1] - set_uniqueid(outputpath, config["PLUG_UNIQUE_ID"]) + # check that the folders are OK + if os.path.isdir(inputprojectname) == False: + print("error: input project not found") + sys.exit(1) - pp = pprint.PrettyPrinter(indent=4) - pp.pprint(config) + if os.path.isdir(outputpath): + print("error: output project allready exists") + sys.exit(1) + # rmtree(output) - print("\ndone - don't forget to change PLUG_MFR_UID in config.h") + print("copying " + inputprojectname + " folder to " + outputpath) + copytree(inputprojectname, outputpath, ignore=ignore_patterns(*DONT_COPY)) -if __name__ == '__main__': - main() + oldroot = "" + newroot = "" + + if numargs == 4: + configpath = os.path.join(inputprojectname, "config") + xcconfig = parse_xcconfig(configpath + "/" + inputprojectname + "-mac.xcconfig") + oldroot = xcconfig["IPLUG2_ROOT"] + iplug2folder = os.path.abspath(os.path.join(configpath, oldroot)) + newroot = os.path.relpath(iplug2folder, os.path.join(outputpath, "config")) + else: + newroot = "" + + # replace manufacturer name strings + for dir in dirwalk( + outputpath, + inputprojectname, + outputprojectname, + "AcmeInc", + manufacturer, + oldroot, + newroot, + ): + pass + + # replace project name in root + for dir in dirwalk( + scriptpath, + inputprojectname, + outputprojectname, + "AcmeInc", + manufacturer, + oldroot, + newroot, + ): + pass + + # replace project name in github + for dir in dirwalk( + scriptpath + "/.github/workflows", + inputprojectname, + outputprojectname, + "AcmeInc", + manufacturer, + oldroot, + newroot, + ): + pass + + # replace project name in vscode + for dir in dirwalk( + scriptpath + "/.vscode", + inputprojectname, + outputprojectname, + "AcmeInc", + manufacturer, + oldroot, + newroot, + ): + pass + + # print("\ncopying gitignore template into project folder\n") + + # copy('gitignore_template', outputpath + "/.gitignore") + + config = parse_config(outputpath) + + config["PLUG_UNIQUE_ID"] = randomFourChar() + + set_uniqueid(outputpath, config["PLUG_UNIQUE_ID"]) + + pp = pprint.PrettyPrinter(indent=4) + pp.pprint(config) + + print("\ndone - don't forget to change PLUG_MFR_UID in config.h") + + +if __name__ == "__main__": + main()