NeuralAmpModelerPlugin

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

makezip-win.py (2142B)


      1 import zipfile, os, fileinput, string, sys, shutil
      2 
      3 scriptpath = os.path.dirname(os.path.realpath(__file__))
      4 projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir))
      5 
      6 IPLUG2_ROOT = "..\..\iPlug2"
      7 
      8 sys.path.insert(0, os.path.join(scriptpath, IPLUG2_ROOT + "\Scripts"))
      9 
     10 from get_archive_name import get_archive_name
     11 
     12 
     13 def main():
     14     if len(sys.argv) != 3:
     15         print("Usage: make_zip.py demo[0/1] zip[0/1]")
     16         sys.exit(1)
     17     else:
     18         demo = int(sys.argv[1])
     19         zip = int(sys.argv[2])
     20 
     21     dir = projectpath + "\\build-win\\out"
     22 
     23     if os.path.exists(dir):
     24         shutil.rmtree(dir)
     25 
     26     os.makedirs(dir)
     27 
     28     files = []
     29 
     30     if not zip:
     31         installer = "\\build-win\\installer\\TemplateProject Installer.exe"
     32 
     33         if demo:
     34             installer = "\\build-win\\installer\\TemplateProject Demo Installer.exe"
     35 
     36         files = [
     37             projectpath + installer,
     38             projectpath + "\\installer\\changelog.txt",
     39             projectpath + "\\installer\\known-issues.txt",
     40             projectpath + "\\manual\\TemplateProject manual.pdf",
     41         ]
     42     else:
     43         files = [
     44             projectpath
     45             + "\\build-win\\TemplateProject.vst3\\Contents\\x86_64-win\\TemplateProject.vst3",
     46             projectpath + "\\build-win\\TemplateProject_x64.exe",
     47         ]
     48 
     49     zipname = get_archive_name(projectpath, "win", "demo" if demo == 1 else "full")
     50 
     51     zf = zipfile.ZipFile(
     52         projectpath + "\\build-win\\out\\" + zipname + ".zip", mode="w"
     53     )
     54 
     55     for f in files:
     56         print("adding " + f)
     57         zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED)
     58 
     59     zf.close()
     60     print("wrote " + zipname)
     61 
     62     zf = zipfile.ZipFile(
     63         projectpath + "\\build-win\\out\\" + zipname + "-pdbs.zip", mode="w"
     64     )
     65 
     66     files = [
     67         projectpath + "\\build-win\\pdbs\\TemplateProject-vst3_x64.pdb",
     68         projectpath + "\\build-win\\pdbs\\TemplateProject-app_x64.pdb",
     69     ]
     70 
     71     for f in files:
     72         print("adding " + f)
     73         zf.write(f, os.path.basename(f), zipfile.ZIP_DEFLATED)
     74 
     75     zf.close()
     76     print("wrote " + zipname)
     77 
     78 
     79 if __name__ == "__main__":
     80     main()