NeuralAmpModelerPlugin

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

update_version-mac.py (10515B)


      1 #!/usr/bin/env python3
      2 
      3 # this script will create/update info plist files based on config.h
      4 
      5 import plistlib, os, sys, shutil
      6 
      7 IPLUG2_ROOT = "../../iPlug2"
      8 
      9 scriptpath = os.path.dirname(os.path.realpath(__file__))
     10 projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir))
     11 
     12 kAudioUnitType_MusicDevice = "aumu"
     13 kAudioUnitType_MusicEffect = "aumf"
     14 kAudioUnitType_Effect = "aufx"
     15 kAudioUnitType_MIDIProcessor = "aumi"
     16 
     17 sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts"))
     18 
     19 from parse_config import parse_config, parse_xcconfig
     20 
     21 
     22 def main():
     23     config = parse_config(projectpath)
     24     xcconfig = parse_xcconfig(
     25         os.path.join(os.getcwd(), IPLUG2_ROOT + "/../common-mac.xcconfig")
     26     )
     27 
     28     CFBundleGetInfoString = (
     29         config["BUNDLE_NAME"]
     30         + " v"
     31         + config["FULL_VER_STR"]
     32         + " "
     33         + config["PLUG_COPYRIGHT_STR"]
     34     )
     35     CFBundleVersion = config["FULL_VER_STR"]
     36     CFBundlePackageType = "BNDL"
     37     CSResourcesFileMapped = True
     38     LSMinimumSystemVersion = xcconfig["DEPLOYMENT_TARGET"]
     39 
     40     print("Processing Info.plist files...")
     41 
     42     # VST3
     43 
     44     plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-VST3-Info.plist"
     45     with open(plistpath, "rb") as f:
     46         vst3 = plistlib.load(f)
     47         vst3["CFBundleExecutable"] = config["BUNDLE_NAME"]
     48         vst3["CFBundleGetInfoString"] = CFBundleGetInfoString
     49         vst3["CFBundleIdentifier"] = (
     50             config["BUNDLE_DOMAIN"]
     51             + "."
     52             + config["BUNDLE_MFR"]
     53             + ".vst3."
     54             + config["BUNDLE_NAME"]
     55             + ""
     56         )
     57         vst3["CFBundleName"] = config["BUNDLE_NAME"]
     58         vst3["CFBundleVersion"] = CFBundleVersion
     59         vst3["CFBundleShortVersionString"] = CFBundleVersion
     60         vst3["LSMinimumSystemVersion"] = LSMinimumSystemVersion
     61         vst3["CFBundlePackageType"] = CFBundlePackageType
     62         vst3["CFBundleSignature"] = config["PLUG_UNIQUE_ID"]
     63         vst3["CSResourcesFileMapped"] = CSResourcesFileMapped
     64 
     65         with open(plistpath, "wb") as f2:
     66             plistlib.dump(vst3, f2)
     67 
     68     # VST2
     69 
     70     plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-VST2-Info.plist"
     71     with open(plistpath, "rb") as f:
     72         vst2 = plistlib.load(f)
     73         vst2["CFBundleExecutable"] = config["BUNDLE_NAME"]
     74         vst2["CFBundleGetInfoString"] = CFBundleGetInfoString
     75         vst2["CFBundleIdentifier"] = (
     76             config["BUNDLE_DOMAIN"]
     77             + "."
     78             + config["BUNDLE_MFR"]
     79             + ".vst."
     80             + config["BUNDLE_NAME"]
     81             + ""
     82         )
     83         vst2["CFBundleName"] = config["BUNDLE_NAME"]
     84         vst2["CFBundleVersion"] = CFBundleVersion
     85         vst2["CFBundleShortVersionString"] = CFBundleVersion
     86         vst2["LSMinimumSystemVersion"] = LSMinimumSystemVersion
     87         vst2["CFBundlePackageType"] = CFBundlePackageType
     88         vst2["CFBundleSignature"] = config["PLUG_UNIQUE_ID"]
     89         vst2["CSResourcesFileMapped"] = CSResourcesFileMapped
     90 
     91         with open(plistpath, "wb") as f2:
     92             plistlib.dump(vst2, f2)
     93 
     94     # AUDIOUNIT v2
     95 
     96     plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-AU-Info.plist"
     97     with open(plistpath, "rb") as f:
     98         auv2 = plistlib.load(f)
     99         auv2["CFBundleExecutable"] = config["BUNDLE_NAME"]
    100         auv2["CFBundleGetInfoString"] = CFBundleGetInfoString
    101         auv2["CFBundleIdentifier"] = (
    102             config["BUNDLE_DOMAIN"]
    103             + "."
    104             + config["BUNDLE_MFR"]
    105             + ".audiounit."
    106             + config["BUNDLE_NAME"]
    107             + ""
    108         )
    109         auv2["CFBundleName"] = config["BUNDLE_NAME"]
    110         auv2["CFBundleVersion"] = CFBundleVersion
    111         auv2["CFBundleShortVersionString"] = CFBundleVersion
    112         auv2["LSMinimumSystemVersion"] = LSMinimumSystemVersion
    113         auv2["CFBundlePackageType"] = CFBundlePackageType
    114         auv2["CFBundleSignature"] = config["PLUG_UNIQUE_ID"]
    115         auv2["CSResourcesFileMapped"] = CSResourcesFileMapped
    116 
    117         if config["PLUG_TYPE"] == 0:
    118             if config["PLUG_DOES_MIDI_IN"]:
    119                 COMPONENT_TYPE = kAudioUnitType_MusicEffect
    120             else:
    121                 COMPONENT_TYPE = kAudioUnitType_Effect
    122         elif config["PLUG_TYPE"] == 1:
    123             COMPONENT_TYPE = kAudioUnitType_MusicDevice
    124         elif config["PLUG_TYPE"] == 2:
    125             COMPONENT_TYPE = kAudioUnitType_MIDIProcessor
    126 
    127         auv2["AudioUnit Version"] = config["PLUG_VERSION_HEX"]
    128         auv2["AudioComponents"] = [{}]
    129         auv2["AudioComponents"][0]["description"] = config["PLUG_NAME"]
    130         auv2["AudioComponents"][0]["factoryFunction"] = config["AUV2_FACTORY"]
    131         auv2["AudioComponents"][0]["manufacturer"] = config["PLUG_MFR_ID"]
    132         auv2["AudioComponents"][0]["name"] = (
    133             config["PLUG_MFR"] + ": " + config["PLUG_NAME"]
    134         )
    135         auv2["AudioComponents"][0]["subtype"] = config["PLUG_UNIQUE_ID"]
    136         auv2["AudioComponents"][0]["type"] = COMPONENT_TYPE
    137         auv2["AudioComponents"][0]["version"] = config["PLUG_VERSION_INT"]
    138         auv2["AudioComponents"][0]["sandboxSafe"] = True
    139 
    140         with open(plistpath, "wb") as f2:
    141             plistlib.dump(auv2, f2)
    142 
    143     # AUDIOUNIT v3
    144 
    145     if config["PLUG_HAS_UI"]:
    146         NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI"
    147     else:
    148         NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit"
    149 
    150     plistpath = (
    151         projectpath + "/resources/" + config["BUNDLE_NAME"] + "-macOS-AUv3-Info.plist"
    152     )
    153 
    154     with open(plistpath, "rb") as f:
    155         auv3 = plistlib.load(f)
    156         auv3["CFBundleExecutable"] = config["BUNDLE_NAME"]
    157         auv3["CFBundleGetInfoString"] = CFBundleGetInfoString
    158         auv3["CFBundleIdentifier"] = (
    159             config["BUNDLE_DOMAIN"]
    160             + "."
    161             + config["BUNDLE_MFR"]
    162             + ".app."
    163             + config["BUNDLE_NAME"]
    164             + ".AUv3"
    165         )
    166         auv3["CFBundleName"] = config["BUNDLE_NAME"]
    167         auv3["CFBundleVersion"] = CFBundleVersion
    168         auv3["CFBundleShortVersionString"] = CFBundleVersion
    169         auv3["LSMinimumSystemVersion"] = "10.12.0"
    170         auv3["CFBundlePackageType"] = "XPC!"
    171         auv3["NSExtension"] = dict(
    172             NSExtensionAttributes=dict(
    173                 AudioComponentBundle="com.AcmeInc.app."
    174                 + config["BUNDLE_NAME"]
    175                 + ".AUv3Framework",
    176                 AudioComponents=[{}],
    177             ),
    178             #                               NSExtensionServiceRoleType = "NSExtensionServiceRoleTypeEditor",
    179             NSExtensionPointIdentifier=NSEXTENSIONPOINTIDENTIFIER,
    180             NSExtensionPrincipalClass="IPlugAUViewController_vTemplateProject",
    181         )
    182         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"] = [{}]
    183         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][
    184             "description"
    185         ] = config["PLUG_NAME"]
    186         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][
    187             "manufacturer"
    188         ] = config["PLUG_MFR_ID"]
    189         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["name"] = (
    190             config["PLUG_MFR"] + ": " + config["PLUG_NAME"]
    191         )
    192         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][
    193             "subtype"
    194         ] = config["PLUG_UNIQUE_ID"]
    195         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][
    196             "type"
    197         ] = COMPONENT_TYPE
    198         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][
    199             "version"
    200         ] = config["PLUG_VERSION_INT"]
    201         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][
    202             "sandboxSafe"
    203         ] = True
    204         auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"] = [
    205             {}
    206         ]
    207 
    208         if config["PLUG_TYPE"] == 1:
    209             auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][
    210                 0
    211             ] = "Synth"
    212         else:
    213             auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][
    214                 0
    215             ] = "Effects"
    216 
    217         with open(plistpath, "wb") as f2:
    218             plistlib.dump(auv3, f2)
    219 
    220     # AAX
    221 
    222     plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-AAX-Info.plist"
    223     with open(plistpath, "rb") as f:
    224         aax = plistlib.load(f)
    225         aax["CFBundleExecutable"] = config["BUNDLE_NAME"]
    226         aax["CFBundleGetInfoString"] = CFBundleGetInfoString
    227         aax["CFBundleIdentifier"] = (
    228             config["BUNDLE_DOMAIN"]
    229             + "."
    230             + config["BUNDLE_MFR"]
    231             + ".aax."
    232             + config["BUNDLE_NAME"]
    233             + ""
    234         )
    235         aax["CFBundleName"] = config["BUNDLE_NAME"]
    236         aax["CFBundleVersion"] = CFBundleVersion
    237         aax["CFBundleShortVersionString"] = CFBundleVersion
    238         aax["LSMinimumSystemVersion"] = LSMinimumSystemVersion
    239         aax["CSResourcesFileMapped"] = CSResourcesFileMapped
    240 
    241         with open(plistpath, "wb") as f2:
    242             plistlib.dump(aax, f2)
    243 
    244     # APP
    245 
    246     plistpath = (
    247         projectpath + "/resources/" + config["BUNDLE_NAME"] + "-macOS-Info.plist"
    248     )
    249 
    250     with open(plistpath, "rb") as f:
    251         macOSapp = plistlib.load(f)
    252         macOSapp["CFBundleExecutable"] = config["BUNDLE_NAME"]
    253         macOSapp["CFBundleGetInfoString"] = CFBundleGetInfoString
    254         macOSapp["CFBundleIdentifier"] = (
    255             config["BUNDLE_DOMAIN"]
    256             + "."
    257             + config["BUNDLE_MFR"]
    258             + ".app."
    259             + config["BUNDLE_NAME"]
    260             + ""
    261         )
    262         macOSapp["CFBundleName"] = config["BUNDLE_NAME"]
    263         macOSapp["CFBundleVersion"] = CFBundleVersion
    264         macOSapp["CFBundleShortVersionString"] = CFBundleVersion
    265         macOSapp["LSMinimumSystemVersion"] = LSMinimumSystemVersion
    266         macOSapp["CFBundlePackageType"] = CFBundlePackageType
    267         macOSapp["CFBundleSignature"] = config["PLUG_UNIQUE_ID"]
    268         macOSapp["CSResourcesFileMapped"] = CSResourcesFileMapped
    269         macOSapp["NSPrincipalClass"] = "SWELLApplication"
    270         macOSapp["NSMainNibFile"] = config["BUNDLE_NAME"] + "-macOS-MainMenu"
    271         macOSapp["LSApplicationCategoryType"] = "public.app-category.music"
    272         macOSapp[
    273             "NSMicrophoneUsageDescription"
    274         ] = "This app needs mic access to process audio."
    275 
    276         with open(plistpath, "wb") as f2:
    277             plistlib.dump(macOSapp, f2)
    278 
    279 
    280 if __name__ == "__main__":
    281     main()