Re: py2exe (setup.py) for pythoncard apps

Brian Debuire <[email protected]> Wed, 21 Nov 2007 02:17:04 +0000
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>

# This is an example setup.py file
# run it from the windows command line like so:
#> C:\Python2.4\python.exe setup.py py2exe
 
from distutils.core import setup
from Common import *
 
import py2exe, shutil, os

# extra files/dirs copied to the project
extra_data = ['data','gfx','conf','help','pyPlan.rsrc.py','pyEstados.rsrc.py','Parametros.rsrc.py','ParamFin.rsrc.py','pyPlan.exe.manifest']

opts = { 
 "py2exe": { 
   # if you import .py files from subfolders of your project, then those are
   # submodules.  You'll want to declare those in the "includes"
     "compressed": 1,
     "optimize": 2,
     "includes":[]
 } 
} 
 
setup(

    version = APP_VERSION,
    description = APP_DESC,
    name = APP_NAME,
    author = APP_AUTHOR,
 
  #this is the file that is run when you start the game from the command line.  
  windows=[{"script": "pyPlan.py","icon_resources": [(1, "pyplan.ico")]}],
  #options as defined above
  options=opts,
  #data files - these are the non-python files, like images and sounds
  #the glob module comes in handy here.
  #data_files = [],
 
  #this will pack up a zipfile instead of having a glut of files sitting
  #in a folder.
  zipfile="lib/shared.zip"
)


#also need to hand copy the extra files here
def installfile(name):
    dst = os.path.join('dist')
    print 'copying', name, '->', dst
    if os.path.isdir(name):
        dst = os.path.join(dst, name)
        if os.path.isdir(dst):
            shutil.rmtree(dst)
        shutil.copytree(name, dst)
    elif os.path.isfile(name):
        shutil.copy(name, dst)
    else:
        print 'Warning, %s not found' % name

for data in extra_data:
    installfile(data)
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/