summaryrefslogtreecommitdiffstats
path: root/Lib/aifc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/aifc.py')
0 files changed, 0 insertions, 0 deletions
name,) - - else: - print "Downloading %s"%(novername,) - downloadURL('http://www.python.org/ftp/python/doc/%s/%s'%( - getFullVersion(), novername), sourceArchive) - print "Archive for %s stored as %s"%(name, sourceArchive) - - extractArchive(os.path.dirname(docdir), sourceArchive) - - os.rename( - os.path.join( - os.path.dirname(docdir), 'python-docs-html'), - docdir) + curDir = os.getcwd() + os.chdir(buildDir) + runCommand('make update') + runCommand('make html') + os.chdir(curDir) + if not os.path.exists(docdir): + os.mkdir(docdir) + os.rename(os.path.join(buildDir, 'build', 'html'), + os.path.join(docdir, 'python-docs-html')) def buildPython(): @@ -935,82 +923,20 @@ def buildDMG(): def setIcon(filePath, icnsPath): """ Set the custom icon for the specified file or directory. - - For a directory the icon data is written in a file named 'Icon\r' inside - the directory. For both files and directories write the icon as an 'icns' - resource. Furthermore set kHasCustomIcon in the finder flags for filePath. """ - ref, isDirectory = Carbon.File.FSPathMakeRef(icnsPath) - icon = Carbon.Icn.ReadIconFile(ref) - del ref - - # - # Open the resource fork of the target, to add the icon later on. - # For directories we use the file 'Icon\r' inside the directory. - # - - ref, isDirectory = Carbon.File.FSPathMakeRef(filePath) - - if isDirectory: - # There is a problem with getting this into the pax(1) archive, - # just ignore directory icons for now. - return - - tmpPath = os.path.join(filePath, "Icon\r") - if not os.path.exists(tmpPath): - fp = open(tmpPath, 'w') - fp.close() - tmpRef, _ = Carbon.File.FSPathMakeRef(tmpPath) - spec = Carbon.File.FSSpec(tmpRef) + toolPath = os.path.join(os.path.dirname(__file__), "seticon.app/Contents/MacOS/seticon") + dirPath = os.path.dirname(__file__) + if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').st_mtime: + # NOTE: The tool is created inside an .app bundle, otherwise it won't work due + # to connections to the window server. + if not os.path.exists('seticon.app/Contents/MacOS'): + os.makedirs('seticon.app/Contents/MacOS') + runCommand("cc -o %s %s/seticon.m -framework Cocoa"%( + shellQuote(toolPath), shellQuote(dirPath))) - else: - spec = Carbon.File.FSSpec(ref) - - try: - Carbon.Res.HCreateResFile(*spec.as_tuple()) - except MacOS.Error: - pass - - # Try to create the resource fork again, this will avoid problems - # when adding an icon to a directory. I have no idea why this helps, - # but without this adding the icon to a directory will fail sometimes. - try: - Carbon.Res.HCreateResFile(*spec.as_tuple()) - except MacOS.Error: - pass - - refNum = Carbon.Res.FSpOpenResFile(spec, fsRdWrPerm) - - Carbon.Res.UseResFile(refNum) - - # Check if there already is an icon, remove it if there is. - try: - h = Carbon.Res.Get1Resource('icns', kCustomIconResource) - except MacOS.Error: - pass - - else: - h.RemoveResource() - del h - - # Add the icon to the resource for of the target - res = Carbon.Res.Resource(icon) - res.AddResource('icns', kCustomIconResource, '') - res.WriteResource() - res.DetachResource() - Carbon.Res.CloseResFile(refNum) - - # And now set the kHasCustomIcon property for the target. Annoyingly, - # python doesn't seem to have bindings for the API that is ne