This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: MacPython build script uses Carbon and MacOS modules slated for removal
Type: enhancement Stage:
Components: Build, macOS Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: janssen, ronaldoussoren
Priority: low Keywords:

Created on 2009-01-05 17:15 by janssen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch-seticon.txt ronaldoussoren, 2009-03-04 23:10
Messages (5)
msg79169 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2009-01-05 17:15
The build script for a Mac OS installer, in
Mac/BuildScript/build-installer.py, currently requires OS 10.4 and
Python 2.3.  At some point it will have to be ported to a newer version
of Python (and Mac OS).  It uses a number of modules which are slated
for future removal, particularly Carbon and MacOS.  These modules are
only used in the function "setIcon".  They can be replaced with a call
to a Cocoa method via PyObjC.  The "setIcon" function using PyObjC would
look like this:

def setIcon(folder, imagefile):

    try:

        import os, AppKit

        AppKit.NSApplicationLoad()      # initialize Cocoa

        return
AppKit.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(
            AppKit.NSImage.alloc().initWithContentsOfFile_(imagefile),
            os.path.abspath(folder), 0)

    except ImportError:
        return False
msg83153 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-03-04 22:42
Usage of PyObjC in the build-script should be avoided, as should eating 
exceptions like you propose. The rationale for not silencing exceptions is 
that the build script is supposed to enable reproducable builds.

I'll probably add a small Cocoa ObjC program to the BuildScript directory 
that uses the API's you mention.
msg83161 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-03-04 23:10
The attached patch shows what I intent do commit after testing. This adds 
a small ObjC command-line tool that sets the icon.  I still have to build 
the installer to check if the patch actually works.
msg83178 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2009-03-05 01:19
Looks good.  The contrast is stark.
msg84582 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-03-30 17:20
Fixed in r70727 (trunk), r70728 (2.6) and r70729 (3.1)
History
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 49098
2009-03-30 17:20:50ronaldoussorensetstatus: open -> closed

messages: + msg84582
2009-03-05 01:19:25janssensetmessages: + msg83178
2009-03-04 23:10:53ronaldoussorensetfiles: + patch-seticon.txt
resolution: accepted
messages: + msg83161
2009-03-04 22:42:17ronaldoussorensetassignee: ronaldoussoren
2009-03-04 22:42:03ronaldoussorensetnosy: + ronaldoussoren
messages: + msg83153
2009-01-05 17:15:57janssencreate