[Python-checkins] python/dist/src/Mac/scripts BuildApplet.py,1.17,1.18 gensuitemodule.py,1.27,1.28
jackjansen@users.sourceforge.net
jackjansen@users.sourceforge.net
Sun, 26 Jan 2003 12:35:50 -0800
Update of /cvsroot/python/python/dist/src/Mac/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv32027
Modified Files:
BuildApplet.py gensuitemodule.py
Log Message:
Use new file dialogs.
Index: BuildApplet.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/scripts/BuildApplet.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** BuildApplet.py 22 Jan 2003 14:03:11 -0000 1.17
--- BuildApplet.py 26 Jan 2003 20:35:47 -0000 1.18
***************
*** 12,16 ****
import os
- import macfs
import MacOS
import EasyDialogs
--- 12,15 ----
***************
*** 37,41 ****
if not sys.argv[1:]:
filename = EasyDialogs.AskFileForOpen(message='Select Python source or applet:',
! fileTypes=('TEXT', 'APPL'))
if not filename:
return
--- 36,40 ----
if not sys.argv[1:]:
filename = EasyDialogs.AskFileForOpen(message='Select Python source or applet:',
! typeList=('TEXT', 'APPL'))
if not filename:
return
***************
*** 87,91 ****
# Loop over all files to be processed
for filename in args:
! cr, tp = MacOS.GetCreatorAndType(macfs.FSRef(filename))
if tp == 'APPL':
buildtools.update(template, filename, dstfilename)
--- 86,90 ----
# Loop over all files to be processed
for filename in args:
! cr, tp = MacOS.GetCreatorAndType(filename)
if tp == 'APPL':
buildtools.update(template, filename, dstfilename)
Index: gensuitemodule.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/scripts/gensuitemodule.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** gensuitemodule.py 7 Aug 2002 15:52:44 -0000 1.27
--- gensuitemodule.py 26 Jan 2003 20:35:47 -0000 1.28
***************
*** 8,11 ****
--- 8,12 ----
import MacOS
+ import EasyDialogs
import os
import string
***************
*** 13,17 ****
import types
import StringIO
- import macfs
import keyword
import macresource
--- 14,17 ----
***************
*** 20,24 ****
from Carbon.Res import *
! DEFAULT_PACKAGEFOLDER=os.path.join(sys.prefix, 'Mac', 'Lib', 'lib-scriptpackages')
def main():
--- 20,24 ----
from Carbon.Res import *
! DEFAULT_PACKAGEFOLDER=os.path.join(sys.prefix, 'Lib', 'plat-mac', 'lib-scriptpackages')
def main():
***************
*** 27,34 ****
processfile(filename)
else:
! fss, ok = macfs.PromptGetFile('Select file with aeut/aete resource:')
! if not ok:
sys.exit(0)
! processfile(fss.as_pathname())
def processfile(fullname):
--- 27,34 ----
processfile(filename)
else:
! filename = EasyDialogs.AskFileForOpen(message='Select file with aeut/aete resource:')
! if not filename:
sys.exit(0)
! processfile(filename)
def processfile(fullname):
***************
*** 232,237 ****
[version, language, script, suites] = aete
major, minor = divmod(version, 256)
! fss = macfs.FSSpec(fname)
! creatorsignature, dummy = fss.GetCreatorType()
packagename = identify(os.path.splitext(os.path.basename(fname))[0])
if language:
--- 232,236 ----
[version, language, script, suites] = aete
major, minor = divmod(version, 256)
! creatorsignature, dummy = MacOS.GetCreatorAndType(fname)
packagename = identify(os.path.splitext(os.path.basename(fname))[0])
if language:
***************
*** 241,253 ****
if len(packagename) > 27:
packagename = packagename[:27]
! macfs.SetFolder(DEFAULT_PACKAGEFOLDER)
! fss, ok = macfs.GetDirectory('Create and select package folder for %s'%packagename)
! if not ok:
return
- pathname = fss.as_pathname()
packagename = os.path.split(os.path.normpath(pathname))[1]
! fss, ok = macfs.GetDirectory('Package folder for base suite (usually StdSuites)')
! if ok:
! dirname, basepkgname = os.path.split(os.path.normpath(fss.as_pathname()))
if not dirname in sys.path:
sys.path.insert(0, dirname)
--- 240,252 ----
if len(packagename) > 27:
packagename = packagename[:27]
! pathname = EasyDialogs.AskFolder(message='Create and select package folder for %s'%packagename,
! defaultLocation=DEFAULT_PACKAGEFOLDER)
! if not pathname:
return
packagename = os.path.split(os.path.normpath(pathname))[1]
! basepkgname = EasyDialogs.AskFolder(message='Package folder for base suite (usually StdSuites)',
! defaultLocation=DEFAULT_PACKAGEFOLDER)
! if basepkgname:
! dirname, basepkgname = os.path.split(os.path.normpath(basepkgname))
if not dirname in sys.path:
sys.path.insert(0, dirname)
***************
*** 255,277 ****
else:
basepackage = None
- macfs.SetFolder(pathname)
suitelist = []
allprecompinfo = []
allsuites = []
for suite in suites:
! code, suite, fss, modname, precompinfo = precompilesuite(suite, basepackage)
if not code:
continue
allprecompinfo = allprecompinfo + precompinfo
! suiteinfo = suite, fss, modname
suitelist.append((code, modname))
allsuites.append(suiteinfo)
for suiteinfo in allsuites:
compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, allprecompinfo)
! fss, ok = macfs.StandardPutFile('Package module', '__init__.py')
! if not ok:
return
! fp = open(fss.as_pathname(), 'w')
! fss.SetCreatorType('Pyth', 'TEXT')
fp.write('"""\n')
fp.write("Package generated from %s\n"%fname)
--- 254,276 ----
else:
basepackage = None
suitelist = []
allprecompinfo = []
allsuites = []
for suite in suites:
! code, suite, pathname, modname, precompinfo = precompilesuite(suite, basepackage)
if not code:
continue
allprecompinfo = allprecompinfo + precompinfo
! suiteinfo = suite, pathname, modname
suitelist.append((code, modname))
allsuites.append(suiteinfo)
for suiteinfo in allsuites:
compilesuite(suiteinfo, major, minor, language, script, fname, basepackage, allprecompinfo)
! initfilename = EasyDialogs.AskFileForSave(message='Package module',
! savedFileName='__init__.py')
! if not initfilename:
return
! fp = open(initfilename, 'w')
! MacOS.SetCreatorAndType(initfilename, 'Pyth', 'TEXT')
fp.write('"""\n')
fp.write("Package generated from %s\n"%fname)
***************
*** 340,348 ****
if len(modname) > 28:
modname = modname[:27]
! fss, ok = macfs.StandardPutFile('Python output file', modname+'.py')
! if not ok:
return None, None, None, None, None
- pathname = fss.as_pathname()
modname = os.path.splitext(os.path.split(pathname)[1])[0]
--- 339,347 ----
if len(modname) > 28:
modname = modname[:27]
! pathname = EasyDialogs.AskFileForSave(message='Python output file',
! savedFileName=modname+'.py')
! if not pathname:
return None, None, None, None, None
modname = os.path.splitext(os.path.split(pathname)[1])[0]
***************
*** 376,388 ****
precompinfo = objc.getprecompinfo(modname)
! return code, suite, fss, modname, precompinfo
! def compilesuite((suite, fss, modname), major, minor, language, script, fname, basepackage, precompinfo):
"""Generate code for a single suite"""
[name, desc, code, level, version, events, classes, comps, enums] = suite
! pathname = fss.as_pathname()
! fp = open(fss.as_pathname(), 'w')
! fss.SetCreatorType('Pyth', 'TEXT')
fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc)))
--- 375,386 ----
precompinfo = objc.getprecompinfo(modname)
! return code, suite, pathname, modname, precompinfo
! def compilesuite((suite, pathname, modname), major, minor, language, script, fname, basepackage, precompinfo):
"""Generate code for a single suite"""
[name, desc, code, level, version, events, classes, comps, enums] = suite
! fp = open(pathname, 'w')
! MacOS.SetCreatorAndType(pathname, 'Pyth', 'TEXT')
fp.write('"""Suite %s: %s\n' % (ascii(name), ascii(desc)))
***************
*** 677,683 ****
def askdefinitionmodule(self, type, code):
! fss, ok = macfs.PromptGetFile('Where is %s %s declared?'%(type, code))
! if not ok: return
! path, file = os.path.split(fss.as_pathname())
modname = os.path.splitext(file)[0]
if not path in sys.path:
--- 675,681 ----
def askdefinitionmodule(self, type, code):
! path = EasyDialogs.AskFileForSave(message='Where is %s %s declared?'%(type, code))
! if not path: return
! path, file = os.path.split(path)
modname = os.path.splitext(file)[0]
if not path in sys.path: