home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / Python 1.3 68K / scripts / fullbuild.py < prev    next >
Encoding:
Python Source  |  1995-10-11  |  2.5 KB  |  105 lines  |  [TEXT/PYTH]

  1. #
  2. # fullbuild creates everything that needs to be created before a
  3. # distribution can be made, and puts it all in the right place.
  4. #
  5. # It expects the projects to be in the places where Jack likes them:
  6. # in directories named like 'build.macppc.shared'. That is fixable,
  7. # however.
  8. #
  9. # NOTE: You should proably make a copy of python with which to execute this
  10. # script, rebuilding running programs does not work...
  11.  
  12. import os
  13. import sys
  14. import macfs
  15.  
  16. import addpack
  17. addpack.addpack('Tools')
  18. addpack.addpack('bgen')
  19. addpack.addpack('AE')
  20. import aetools
  21. from Metrowerks_Shell_Suite import Metrowerks_Shell_Suite
  22. from Required_Suite import Required_Suite 
  23.  
  24. addpack.addpack('Mac')
  25. addpack.addpack('scripts')
  26. import mkapplet
  27.  
  28. class MwShell(aetools.TalkTo, Metrowerks_Shell_Suite, Required_Suite):
  29.     pass
  30.  
  31.  
  32. def buildmwproject(top, creator, projects):
  33.     """Build projects with an MW compiler"""
  34.     print 'Please start project mgr with signature', creator,'-'
  35.     sys.stdin.readline()
  36.     try:
  37.         mgr = MwShell(creator)
  38.     except 'foo':
  39.         print 'Not handled:', creator
  40.         return
  41.     for file in projects:
  42.         file = os.path.join(top, file)
  43.         fss = macfs.FSSpec(file)
  44.         print 'Building', file
  45.         mgr.open(fss)
  46.         mgr.Make_Project()
  47.         mgr.Close_Project()
  48.     mgr.quit()
  49.     
  50. def buildapplet(top, dummy, list):
  51.     """Create a PPC python applet"""
  52.     template = mkapplet.findtemplate()
  53.     for src in list:
  54.         if src[-3:] != '.py':
  55.             raise 'Should end in .py', src
  56.         base = os.path.basename(src)
  57.         dst = os.path.join(top, base)[:-3]
  58.         src = os.path.join(top, src)
  59.         try:
  60.             os.unlink(dst)
  61.         except os.error:
  62.             pass
  63.         print 'Building applet', dst
  64.         mkapplet.process(template, src, dst)
  65.  
  66. #
  67. # The build instructions. Entries are (routine, arg, list-of-files)
  68. # XXXX We could also include the builds for stdwin and such here...
  69. INSTRUCTIONS=[
  70.     (buildmwproject, "CWIE", [
  71.         ":build.macppc.shared:PythonCore.µ",
  72.         ":build.macppc.shared:PythonPPC.µ",
  73.         ":build.macppc.shared:PythonApplet.µ",
  74.  
  75.         ":PlugIns:ctbmodule.µ",
  76.         ":PlugIns:imgmodules.µ",
  77.         ":PlugIns:macspeechmodule.µ",
  78.         ":PlugIns:mactcpmodules.µ",
  79.         ":PlugIns:stdwinmodule.µ",
  80.         ":PlugIns:toolboxmodules.µ",
  81.  
  82.         ":build.mac68k.stand:Python68K.µ",
  83.     ]),
  84.     (buildapplet, None, [
  85.         ":Mac:scripts:EditPythonPrefs.py",
  86.         ":Mac:scripts:mkapplet.py",
  87.         ":Mac:scripts:RunLibScript.py",
  88.         ":Mac:scripts:MkPluginAliases.py"
  89.     ])
  90. ]
  91.                 
  92. def main():
  93.     dir, ok = macfs.GetDirectory('Python source folder:')
  94.     if not ok:
  95.         sys.exit(0)
  96.     dir = dir.as_pathname()
  97.     for routine, arg, list in INSTRUCTIONS:
  98.         routine(dir, arg, list)
  99.     print "All done!"
  100.     sys.exit(1)    
  101.     
  102. if __name__ == '__main__':
  103.     main()
  104.     
  105.