On 12-sep-2005, at 15:57, Jack Nutting wrote:



On 9/12/05, Bob Ippolito <[EMAIL PROTECTED]> wrote:
Patches accepted at http://sourceforge.net/projects/python :)

I don't know where the packagemaker configuration file is, but here's a step toward something that would work in postflight:


#!/bin/sh

dialogText="Version 2.4.1 of python has now been installed in /usr/ local/bin. You probably want to use this new version as the default python, so that other python-using programs will find it instead of the built-in version. I can take care of this by putting /usr/local/bin/ at the front of your shell path. Should I do this for you?"
osascriptOutput=`/usr/bin/mktemp /tmp/osascript_XXXXXXXXX`
osascript >$osascriptOutput <<appleScriptEnd
on display_message_dialog()
    try
        tell application "Finder" to display dialog "$dialogText"
    on error errMsg number errnum
        if errnum is -128 then --If user canceled
            return 0
        else
            error errMsg
        end if
    end try
    return 1
end display_message_dialog

tell application "Finder" to activate
set dialogResult to display_message_dialog()
tell application "Terminal" to activate

return dialogResult
appleScriptEnd

shouldInsertIntoPath=`cat $osascriptOutput`
if [ $shouldInsertIntoPath = 1 ]; then
    # user hit OK, now mangle their startup scripts
    echo got yes!
fi


(obviously I left out the part where we actually modify the user's .profile, .bash_profile, .cshrc, and/or .tcshrc, but I thought that this bit of applescript hackery could help someone along the way)

You left out the interesting part! Which user's profile should be modified, just the users that installed the package? Too bad if a user tries to keep admin privileges away from his normal account (or if a parent installs python because her kid wants to program in python). You could also modify /etc/profile (and /etc/csh.login and ...) to modify the PATH for everyone, change environment.plist or ...

This would also make it harder to do unattended installs of Python (using Remote Desktop's install feature, or even using installer(1) in an ssh session).

Another option is making a .mpkg for python and have one subpackage that does the 'echo got yes!' part in its postflight script (unconditionally) and add tekst to the ReadMe screen that tells the users to select this package if he wants to modify the shell environment.

Ronald

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to