From: Greg Ercolano <erco_mlist@(email surpressed)>
Subject: Re: [Q+A] How do I make custom versions of submit scripts for OSX?
   Date: Thu, 06 Sep 2018 20:46:37 -0400
Msg# 2411
View Complete Thread (2 articles) | All Threads
Last Next
On 08/23/06 21:18, Greg Ercolano wrote:
>  > i'd like to make a copy of the submit-maya.pl script so i can
>  > make customizations for specific purposes. but i want to leave
>  > the original in place for other users to use.
>  >
>  > i made a copy of submit-maya.pl called submit-maya-IPR.pl,
>  > and I can invoke it from the command line just fine as:
>  >
>  > perl //ourserver/rushscripts/submit-maya-IPR.pl
>  >
>  > ..but if i try to make a copy of the Applications/submit-maya.app
>  > so that i can click on it from the Finder, my copy doesn't work.
>  > i tried both using the Finder and 'cp -r' to make the copy, but
>  > neither technique seems to work. what is the .app stuff anyway?
> 
>      Yes, the .app stuff.
> 
>      This is an Apple thing. For whatever reason, the designers of the OSX
>      Desktop and Finder didn't implement things so that you could just run
>      a script by double-clicking on it. Even if the script has execute bits
>      enabled with chmod 755, the Finder will still open it in a text editor..!
> 
>      So for the Mac, the submit scripts are packaged with an 'Application Bundle',
>      (the ".app" directory), which is a directory structure defined by Apple
>      to replace the older 'resource fork' stuff.

    An update to this older message.

    In addition to the technique shown in this thread, in Rush 103 and up
    you have the option of including your custom perl or python script
    /inside/ the .app directory (in Contents/MacOS/) so that the .app
    can be dropped anywhere on a network drive and still operate.

    You just have to make sure the script and any require/import files
    are in the same dir:

        > For the perl submits, the .common.pl is needed

        > For the python submits, the /lib/ directory is needed.

    These files can also be symlinks to a network path instead of copies,
    to avoid having multiple copies of the .common.pl/lib files.

    The reason the Rush distribution doesn't do this is so that the
    scripts can operate in a cross platform environment, without needing
    copies of the scripts both with and without a .app wrapper.

    As an example of packaging the submit script INSIDE the .app directory,
    here is a perl submit called submit-xxx.pl, where it and the .common.pl
    file are both in the Contents/MacOS/ part of the .app bundle:

submit-xxx.app/
submit-xxx.app/Contents
submit-xxx.app/Contents/Info.plist
submit-xxx.app/Contents/MacOS
submit-xxx.app/Contents/MacOS/.common.pl      <-- .common.pl has to be here so the submit script can pick it up
submit-xxx.app/Contents/MacOS/README.txt
submit-xxx.app/Contents/MacOS/submit-xxx
submit-xxx.app/Contents/MacOS/submit-xxx.pl   <-- perl script goes here -- should be executable
submit-xxx.app/Contents/PkgInfo
submit-xxx.app/Contents/Resources
submit-xxx.app/Contents/Resources/icon.icns

    So now when you double-click on the submit-xxx from the Finder or browser,
    it runs the submit-xxx executable, which in turn looks for the perl script
    in the same dir, and if it finds it, runs it. Once the script starts running,
    it looks for the .common.pl to be in the same dir, finds it, and the GUI pops open.

    Note that the .common.pl file can also be a symlink to a network path if need be,
    to avoid having multiple copies of that file.

    Similarly for python scripts, you can put the python script (and its /lib/ dir)
    in the Contents/MacOS part of the .app bundle:

submit-xxx.app/
submit-xxx.app/Contents
submit-xxx.app/Contents/Info.plist
submit-xxx.app/Contents/MacOS
submit-xxx.app/Contents/MacOS/lib/                  <-- lib directory that has all the Rush python modules the submit scripts need
submit-xxx.app/Contents/MacOS/lib/[..many files..]
submit-xxx.app/Contents/MacOS/lib/[..snipped..]
submit-xxx.app/Contents/MacOS/README.txt
submit-xxx.app/Contents/MacOS/submit-xxx
submit-xxx.app/Contents/MacOS/submit-xxx.py         <-- Python script goes here -- should be executable
submit-xxx.app/Contents/PkgInfo
submit-xxx.app/Contents/Resources
submit-xxx.app/Contents/Resources/icon.icns

     ..and as described with the perl script, the double-click behavior
     is the same.

Last Next