-

Return to General Discussion

-

Postby lettier » Tue Nov 22, 2005 1:03 am

-
Last edited by lettier on Fri Mar 15, 2013 4:02 pm, edited 1 time in total.
lettier
 
Posts: 154
Joined: Tue Oct 18, 2005 7:28 pm

-

Postby lettier » Tue Nov 22, 2005 11:15 am

-
Last edited by lettier on Fri Mar 15, 2013 4:02 pm, edited 1 time in total.
lettier
 
Posts: 154
Joined: Tue Oct 18, 2005 7:28 pm

Postby russ » Tue Nov 22, 2005 11:21 am

Where does your built version of panda look for the python executable? Is that where you are running your setup.py from? What I mean is, if you have two versions of python 2.4, one might not know where to look for the direct tree where the other one would. So if you haven't yet, try running ppython setup.py instead of python setup.py
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

-

Postby lettier » Tue Nov 22, 2005 11:31 am

-
Last edited by lettier on Fri Mar 15, 2013 4:02 pm, edited 1 time in total.
lettier
 
Posts: 154
Joined: Tue Oct 18, 2005 7:28 pm

xyz

Postby Josh Yelon » Tue Nov 22, 2005 12:02 pm

I've never used py2exe, so I can't help much there.

However, I can say this: the pandac module is implemented quite differently under 1.1 than under 1.0. If you figure out how to solve it under 1.0, you'll probably have to use a different solution under 1.1. Under 1.1, here's how it works:

Each DLL such as "libpandaexpress" contains a bunch of python classes and methods. These are self-contained in the sense that you can import them directly into python without any sort of intervening wrapper and it works fine. For example, you can say:

from libpandaexpress import *

and you'll get a bunch of the panda classes. In fact, I think their intent is to gradually move toward a system where you just import classes directly from the DLLs in the way I just showed.

However, in a few unusual cases, the disney guys are mixing C++ and python classes like this:

* Define the class in C++
* Write most of the methods in C++
* Write a few "extra methods" in python.

If you just import the classes directly from the DLLs, you'll get the C++ class definition and the C++ methods, but you'll miss out on the "extra methods." That's what the "pandac" directory is for.

The pandac directory contains small files that look like this:

from libpandaexpress import *
define extra method 1
insert extra method 1 into such-and-such class
define extra method 2
insert extra method 2 into such-and-such class
etc, etc.

So basically, 90 percent of the work consists of just importing the class and its methods from the DLLs, and the remaining 10 percent is attaching the python methods to the C++ classes.

I don't know if that will help you sort this out, I hope it does, though.
Josh Yelon, Teacher, Carnegie Mellon Entertainment Technology Center
Josh Yelon
 
Posts: 1360
Joined: Wed Mar 30, 2005 8:30 pm

Postby Martin » Wed Nov 23, 2005 5:26 am

I haven't checked this method but maybe it works:

*)Use packpanda http://www.panda3d.org/phpbb2/viewtopic.php?t=884
*)Install it on your computer
*)Start py2exe for this installed game
Martin
 
Posts: 275
Joined: Wed Jul 27, 2005 4:59 pm
Location: Vienna, Austria - EU

Postby russ » Wed Feb 08, 2006 5:45 pm

I have recently tried to make some progress on this, but have only narrowed the problem...

I have installed py2exe into a registered version of python and copied the files over to the site-packages directory in panda3d's python (although IPKnightly's method above would have worked just as well). I then created a setup.py the same as IPKnightly with all of the direct packages listed, and tried testing it on a simple one-file panda application. I built the file using ppython and these were the warnings:

warning: py2exe: *****************************************
warning: py2exe: * The following modules were not found:
warning: py2exe: * pandac.DCSubatomicType
warning: py2exe: * pandac.LODNode
warning: py2exe: * pandac.NotifyCategory
warning: py2exe: * pandac.NotifySeverity
warning: py2exe: * pandac.PStatCollector
warning: py2exe: * pandac.ParticleSystemManager
warning: py2exe: * pandac.PhysicsManager
warning: py2exe: * pandac.libpandaexpressModules
warning: py2exe: * readline
warning: py2exe: *****************************************


The first run of the executable, I got this error:

File "pandac\PandaModules.pyc", line 20, in ?
ImportError: Could not locate pandac.PandaModules.pyz


I remembered that PandaModules looks for the .pyz file in the same directory its located, so I copied PandaModules.pyz into the same directory that the executable was. I figured this was ok since PandaModules.pyz is just a bunch of zipped up python files for faster loading (maybe I am wrong about that).

After a couple more runs I had errors about missing .dll files. These were:
ImportError: No module named libdtoolconfig

and:
ImportError: No module named libpandaexpress


I copied those .dll files to the same directory as the executable as well. I really just wanted to see how far I could get. The last error I got was:
...
File "libpandaexpressModules", line 14, in ?
File "ihooks.pyc", line 397, in import_module
File "ihooks.pyc", line 433, in find_head_package
File "ihooks.pyc", line 486, in import_it
File "<package>", line 29, in load_module
File "libpandaexpressDowncasts", line 6, in ?
File "ihooks.pyc", line 397, in import_module
File "ihooks.pyc", line 433, in find_head_package
File "ihooks.pyc", line 486, in import_it
File "<package>", line 29, in load_module
File "ISocketStream", line 10, in ?
File "ihooks.pyc", line 398, in import_module
File "ihooks.pyc", line 451, in load_tail
ImportError: No module named pandac.direct.ffi

I am assuming this was because I was copying dlls into places they should not have been.

When I moved the enitre directory containing the executable outside of the folder I built it in, I finally got IPKnightly's error of

Cannot find the 'direct' tree


I figured out that this has nothing to do with pandac, but rather the fact that the direct/__init__.py file was not trivial. Here is the code from that file:

Code: Select all
import os,sys
srcdir1 = os.path.join(__path__[0], 'src')
srcdir2 = os.path.join(__path__[0], '..', '..', 'direct', 'src')
if    (os.path.isdir(srcdir1)): __path__[0] = srcdir1
elif  (os.path.isdir(srcdir2)): __path__[0] = srcdir2
else: sys.exit("Cannot find the 'direct' tree")


Basically it looks for a path either with 'src' appended to the path name, or two levels up from the current directory and then 'direct/src'.

Before I had moved my executable file, it was two directories deep from the direct folder in panda, which inadvertently resolved that issue, but reappeared when I moved the location away from that particular directory structure.

So the real question is what is the best way to fix the non-trivial __init__ problem? When byte-compiled, the __init__.py file needs to be able to look for the direct packages without trying to mangle the path. At leat thats my best guess. The quick solution would be to include the direct package two directories above the distribution executable, but that is really just a hack and I would like to find the 'correct' solution.

Any help would be greatly appreciated.
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Postby drwr » Wed Feb 08, 2006 5:59 pm

Well, the fancy __init__.py file is really itself just a hack to allow people to run files out of direct/src/whatever, instead of direct/whatever, which is where the installed files should end up when they are published. I would just copy the Python files into the appropriate places in the publish tree, omitting the intervening "src" directory, and omitting the __init__.py files.

But isn't this whole problem already solved with Josh's packpanda tool?

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby russ » Thu Feb 09, 2006 12:00 pm

I am using version 1.0.5 which doesn't have packpanda. I did install version 1.1.0 to try it out on the same file , but got an error:

C:\PandaStuff>packpanda --game pandaAnim
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: No module named packpanda


I figured trying to fix packpanda (the fixes found here and here), and then debug it to build it into version 1.0.5 would be a lot more work than I could handle right now. I was hoping that getting py2exe to work might be easier.

I'll try to resturcture the direct packages and see how it goes. Any ideas on why there are a few select pandac modules missing? I would think it would be all or nothing. Does moving the PandaModules.pyz file fix that problem?
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Postby drwr » Thu Feb 09, 2006 1:06 pm

Any ideas on why there are a few select pandac modules missing? I would think it would be all or nothing. Does moving the PandaModules.pyz file fix that problem?

You mean the dll's? These have to be loaded by the system, so they have to be found somewhere on sys.path, regardless of where PandaModules.pyz is found. As to why you only got an error from two of them, well, those are the first two loaded; I bet you will get the same error from the rest of them when you get further.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby Yellow » Thu Feb 09, 2006 1:48 pm

I thought the packpanda util just made an installer for the program, but doesnt freeze the actual program into an exe like py2exe ?
Yellow
 
Posts: 146
Joined: Fri Aug 19, 2005 8:36 pm

Postby russ » Thu Feb 09, 2006 3:32 pm

Thanks David, I appreciate all of the help.

I was actually referring to the initial warnings from py2exe, but knowing that all of the dll files will be missing will help. I'll try to find a solution.

Also, as far as I know, packpanda is an installer for .py or .pyc files that also installs panda (or some minimal version of it). It says packpanda was used to create the Airblade.exe found in the software downloads, so that might give an example of a finished packpanda distribution.
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Postby Yellow » Thu Feb 09, 2006 3:43 pm

In that case, I'd recomend sticking with a combination of ino setup and py2exe. I already compiled a panda3d program with it with panda 1.0.5 and 1.1.0. Using 1.1.0 its much easier, but sadly, I already deleted the test compiles I did.....

I just remember that the direct package is abit of a bastard in this, I think I had a second copy in my libarary.zip, but then with all modules in the direct dir, not source. And yes, you need to copy most .dll files from your bin dir to the dist dir.

good luck, if you want me to redo what I did, I'll have a look.

Edit:

Oh and yeah, I seem to remember that you needed to edit some of the modules, they're just a few from the pandac bundle though
Yellow
 
Posts: 146
Joined: Fri Aug 19, 2005 8:36 pm

Postby russ » Fri Feb 10, 2006 5:13 pm

Thanks Yellow

I restructured the direct tree and unzipped the PandaModules.pyz file using genpycode. This created all of the pandac files which allowed py2exe to search for the dll files to copy over. So that was taken care of. It also deleted the PandaModules.py file as well, which a lot of files import from. So I created my own PandaModules.py file like this:

Code: Select all
#PandaModules.py
from libpandaModules import *

import ConfigConfigureGetConfigConfigShowbase
import CIntervalManager
import CInterval
import LinearEulerIntegrator
import CLerpAnimEffectInterval


ConfigConfigureGetConfigConfigShowbase = ConfigConfigureGetConfigConfigShowbase.ConfigConfigureGetConfigConfigShowbase
CIntervalManager = CIntervalManager.CIntervalManager
CInterval = CInterval.CInterval
LinearEulerIntegrator = LinearEulerIntegrator.LinearEulerIntegrator
CLerpAnimEffectInterval = CLerpAnimEffectInterval.CLerpAnimEffectInterval


I created the extra imports from error messages given by running through it a couple times. I would think there is a file similar to libpandaModules that has these imports, and probably others that I am missing. Anyone know which?

The most recent error I am recieving is:
Traceback (most recent call last):
File "<string>", line 42, in ?
File "direct\showbase\ShowBase.pyc", line 1603, in run
File "direct\task\Task.pyc", line 781, in run
File "direct\task\Task.pyc", line 728, in step
File "direct\task\Task.pyc", line 671, in __stepThroughList
File "direct\task\Task.pyc", line 602, in __executeTask
File "direct\showbase\ShowBase.pyc", line 1200, in igLoop
NameError: global name 'throwNewFrame' is not defined


The corresponding code in ShowBase:
Code: Select all
        # Lerp stuff needs this event, and it must be generated in
        # C++, not in Python.
        throwNewFrame()


Where is throwNewFrame() located? I am guessing It would have been imported into PandaModules at some point, which I would have missed.

Thanks again
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Postby drwr » Fri Feb 10, 2006 6:09 pm

Right, throwNewFrame() is a C++ function (defined in showBase.cxx, and called throw_new_frame() there) that should have been imported when you imported the contents of PandaModules. Maybe there's something missing in the PandaModules.py that you created.

You could try running genpycode -n. This should generate a PandaModules.py and a long list of separate *.py files, instead of zipping them all up into PandaModules.pyz.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby russ » Sat Feb 11, 2006 3:31 pm

Many, many thanks. That was just what I needed. It all works now.
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Postby Martin » Thu Feb 16, 2006 3:24 am

Can you post that file you have used for making the exe.
Or can you write a tutorial in the manual for making an exe with py2exe.

Thanks Martin
Martin
 
Posts: 275
Joined: Wed Jul 27, 2005 4:59 pm
Location: Vienna, Austria - EU

Postby russ » Thu Feb 16, 2006 12:10 pm

The setup.py file I use is outdated. I am using py2exe version 0.4.1 so that it is compatible with python 2.2 and Panda1.0.5. If you are using Panda1.1.0, the file will look different, namely the 'scripts' argument will be a 'console' or 'windows' argument. anyway, here it is.

Code: Select all
#setup.py
from distutils.core import setup
from distutils.core import Extension

import py2exe

setup(name = "pandaRun",
      scripts = ["pandaAnim.py"],
      packages = ['direct',
                  'direct.directbase',
                  'direct.showbase',
                  'direct.interval',
                  'direct.actor',
                  'direct.gui',
                  'direct.showbase',
                  'direct.task',
                  'direct.controls',
                  'direct.directnotify',
                  'direct.directtools',
                  'direct.directutil',
                  'direct.fsm',
                  'direct.ffi',
                  'direct.particles',
                  'direct.tkpanels',
                  'direct.tkwidgets',
                  'direct.cluster',
                  'direct.directdevices',
                  'direct.distributed',
                  'pandac'
                 ],
        package_dir = {'direct' : 'C:\\Panda3D-1.0.5\\direct',
        'direct.directbase' : 'C:\\Panda3D-1.0.5\\direct\\directbase',
        'direct.showbase' : 'C:\\Panda3D-1.0.5\\direct\\showbase',
        'direct.interval' : 'C:\\Panda3D-1.0.5\\direct\\interval',
        'direct.actor' : 'C:\\Panda3D-1.0.5\\direct\\actor',
        'direct.gui' : 'C:\\Panda3D-1.0.5\\direct\\gui',
        'direct.showbase' : 'C:\\Panda3D-1.0.5\\direct\\showbase',
        'direct.task' : 'C:\\Panda3D-1.0.5\\direct\\task',
        'direct.controls' : 'C:\\Panda3D-1.0.5\\direct\\controls',
        'direct.directnotify' :'C:\\Panda3D-1.0.5\\direct\\directnotify',
        'direct.directtools' : 'C:\\Panda3D-1.0.5\\direct\\directtools',
        'direct.directutil' : 'C:\\Panda3D-1.0.5\\direct\\directutil',
        'direct.fsm' : 'C:\\Panda3D-1.0.5\\direct\\fsm',
        'direct.ffi' : 'C:\\Panda3D-1.0.5\\direct\\ffi',
        'direct.particles' : 'C:\\Panda3D-1.0.5\\direct\\particles',
        'direct.tkpanels' : 'C:\\Panda3D-1.0.5\\direct\\tkpanels',
        'direct.tkwidgets' : 'C:\\Panda3D-1.0.5\\direct\\tkwidgets',
        'direct.cluster' : 'C:\\Panda3D-1.0.5\\direct\\cluster',
        'direct.directdevices' : 'C:\\Panda3D-1.0.5\\direct\\directdevices',
        'direct.distributed' : 'C:\\Panda3D-1.0.5\\direct\\distributed',
        'pandac' : 'C:\\Panda3D-1.0.5\\pandac'
        }
     
)


I'll see if I have time this weekend to test out 1.1.0 with the newest version of py2exe.
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Postby Martin » Fri Feb 17, 2006 3:00 pm

Thanks a lot
Martin
 
Posts: 275
Joined: Wed Jul 27, 2005 4:59 pm
Location: Vienna, Austria - EU

Postby Drew » Mon Feb 20, 2006 7:27 pm

russ wrote:I'll see if I have time this weekend to test out 1.1.0 with the newest version of py2exe.


Any progress with that? I'm trying to build an .exe with Panda 1.1.0, Python 2.4, and the latest py2exe, without much luck.

I've created a setup.py file explicitly listing all the panda modules, and I'm getting the following error when I try to run the .exe:

Traceback (most recent call last):
File "client.py", line 8 in ?
File "direct\__init__.pyc", line 7, in ?
NameError: name 'exit' is not defined


It appears that it doesn't like the line:

else: exit("Cannot find the 'direct' tree")


Of course, it's only getting there because it's not finding the direct module files. I've been over this thread trying to figure out how to get it to work without much luck. I tried moving the direct modules from direct/src directory to direct and modified the __init__ file, which got me a different error:

StandardError: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
Drew
 
Posts: 7
Joined: Mon Feb 20, 2006 7:14 pm

Postby russ » Mon Feb 20, 2006 8:38 pm

Moving the direct packages out of the src directory and deleting the code in the __init__ file worked. It looks like you need to copy the 'etc' directory over to your dist. Py2exe only looks for python modules and any associated .dll files. Anything else (meaning the Config.prc files) you pretty much have to copy over manually.
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Postby Drew » Tue Feb 21, 2006 5:28 pm

russ wrote:Moving the direct packages out of the src directory and deleting the code in the __init__ file worked. It looks like you need to copy the 'etc' directory over to your dist. Py2exe only looks for python modules and any associated .dll files. Anything else (meaning the Config.prc files) you pretty much have to copy over manually.

Thanks, that did the trick. I imagine it should be possible to add code to the setup.py script to copy the needed files over automatically as well.
Drew
 
Posts: 7
Joined: Mon Feb 20, 2006 7:14 pm

Postby russ » Wed Feb 22, 2006 11:06 am

Ok, so if you are using python 2.4, you can include other files.
this is from http://docs.python.org/dist/node12.html

Code: Select all
setup(...
      data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
                  ('config', ['cfg/data.cfg']),
                  ('/etc/init.d', ['init-script'])]
     )
russ
 
Posts: 223
Joined: Wed May 04, 2005 5:32 pm

Generic Py2Exe Script

Postby aaronbstjohn » Fri Apr 13, 2007 12:13 pm

Hi, I got an private message from Osirus requesting that I share my py2exe code. I figure if it's useful to one person, it may be useful to others.

I am writing a whole set of utilities based off of panda so I wrote a generic py2exe setup script that lets me easily retarget the python code that gets packaged.

The code is split up into two files build.py and pandasetup.py. build.py collects commandline arguments and calls setup. pandasetup.py just manages all of the directories and paths required to build panda into the final distibutable.

You should be able to make an exe w/this code using the following example commandline:

ppython -OO build.py -f mytestfile.py -r src

NOTE: in this example, your code would be in a directory named "src" and there would be a file in that directory called "mytestfile.py" that you wanted to turn into an .exe

However, I never run the code this way myself. Instead I made a target for apache ant that lets me run py2exe w/through these scripts during my build process. I included this code as well.


Code: Select all
#Listing for build.py
import os
import glob
from pandasetup import *
#import distutils
from distutils.core import setup
from optparse import OptionParser
import sys
from string import *
import py2exe



parser = OptionParser()

parser.add_option("-p",
                  "--pandapath",
                  dest="pandapath",
                  default = "C:\\Panda3D-1.3.2",
                  help="Path to Panda")

parser.add_option("-r",
                  "--rootpath",
                  dest="rootpath",
                  default = "src",
                  help="Project Root")

parser.add_option("-f",
                  "--file",
                  dest="buildfile",
                  default = "test.py",
                  help="file to compile FILE", metavar="FILE")

parser.add_option("-d",
                  "--dist",
                  dest="distpath",
                  default = "dist",
                  help="Directory Output DIR",metavar="DIR")

parser.add_option("-l",
                  "--library",
                  dest="libfile",
                  default = "library.zip",
                  help="Zipfile libraryname")

parser.add_option("-w",
                  "--windowed",
                  dest="windowed",
                  default = False,
                 help="Run in windows mode")

parser.add_option("-i",
                  "--icon",
                  dest="icon_path",
                  default = "icon.ico",
                  help="Icon path")


(cmdopts, args) = parser.parse_args()
print "argv: "+str(sys.argv)
sys.argv=[sys.argv[0],'py2exe']
print "Current Working Dir: "+str(os.getcwd())
def createSetupCommandLine(pandapath,
                           rootpath,
                           buildfile,
                           distpath,
                           libfile,
               iconpath,
                           isWindowed):
    args ={}
    if(isWindowed):
       args['windows']=[{"script":os.path.join(rootpath,buildfile),"icon_resources":[(1,iconpath)]}]
    else:
        args['console']=[{"script":os.path.join(rootpath,buildfile),"icon_resources":[(1,iconpath)]}]
   
    args['zipfile'] = libfile
    py2exeOpts= {}
    py2exeOpts['unbuffered']=True
    py2exeOpts['optimize']=2
    py2exeOpts['dist_dir']=distpath           
   
    args['options'] = {'py2exe':py2exeOpts}
    args['packages'] = getPackages()
    args['package_dir'] = getPackageDirs(pandapath,rootpath)
    args['data_files'] = getDataFiles(pandapath)
    return args


setupArgs =createSetupCommandLine(strip(cmdopts.pandapath),
                                  os.path.join(os.getcwd(),strip(cmdopts.rootpath)),
                                  strip(cmdopts.buildfile),
                                  os.path.join(os.getcwd(),strip(cmdopts.distpath)),
                                  strip(cmdopts.libfile),
                   cmdopts.icon_path,
                                  cmdopts.windowed)
setup(**setupArgs)


Code: Select all
#Listing for pandasetup.py
import os
import glob
def getPackages():
    return [ '',
            'direct',
            'direct.directbase',
            'direct.showbase',
            'direct.interval',
            'direct.actor',
            'direct.gui',
            'direct.task',
            'direct.controls',
            'direct.directnotify',
            'direct.directtools',
            'direct.directutil',
            'direct.fsm',
            'direct.cluster',
            'direct.particles',
            'direct.tkpanels',
            'direct.tkwidgets',
            'direct.directdevices',
            'direct.distributed',
            'pandac',
            ]

def getPackageDirs(pandapath,srcdir):
    return {    '':srcdir,
                'direct' : os.path.join(pandapath, 'direct'),
                'direct.directbase' : os.path.join(pandapath, 'direct/directbase'),
                'direct.showbase' : os.path.join(pandapath, 'direct/showbase'),
                'direct.interval' : os.path.join(pandapath, 'direct/interval'),
                'direct.actor' : os.path.join(pandapath, 'direct/actor'),
                'direct.gui' : os.path.join(pandapath, 'direct/gui'),
                'direct.task' : os.path.join(pandapath, 'direct/task'),
                'direct.controls' : os.path.join(pandapath, 'direct/controls'),
                'direct.directnotify' : os.path.join(pandapath, 'direct/directnotify'),
                'direct.directtools' : os.path.join(pandapath, 'direct/directtools'),
                'direct.directutil' : os.path.join(pandapath, 'direct/directutil'),
                'direct.fsm' : os.path.join(pandapath, 'direct/fsm'),
                'direct.cluster' : os.path.join(pandapath, 'direct/cluster'),
                'direct.particles' : os.path.join(pandapath, 'direct/particles'),
                'direct.tkpanels' : os.path.join(pandapath, 'direct/tkpanels'),
                'direct.tkwidgets' : os.path.join(pandapath, 'direct/tkwidgets'),
                'direct.directdevices' : os.path.join(pandapath, 'direct/directdevices'),
                'direct.distributed' : os.path.join(pandapath, 'direct/distributed'),
                'pandac' : os.path.join(pandapath, 'pandac'),
                }
def getDataFiles(pandapath):
    return [    ('etc', [os.path.join(pandapath, 'etc/Config.prc')]),
                # make sure all dlls are copied from Panda3D
                ('.', glob.glob(os.path.join(pandapath, 'bin/*.dll'))),
            ]



Code: Select all
<!--ANT Py2exe code for panda-->
<project>
    <property name="panda.dir" value="C:\Panda3D-1.3.2"/>
    <property name="panda.bin.dir" value="${panda.dir}\bin"/>
    <property name="panda.python.dir" value="${panda.dir}\python"/>
    <property name="ppython.exe" value="${panda.python.dir}\ppython.exe"/>
    <property name="py2exe.tools.dir" location="tools\py2exe"/>
    <property name="py2exeHelper" value="${py2exe.tools.dir}\build.py"/>

    <target name="py2exe">
        <echo message="pyfile=${pyfile}"/>
        <echo message="Python : ${ppython.exe}"/>
        <echo message="Panda Dir: ${panda.dir}"/>
        <echo message="Src Dir : ${src.dir}"/>
        <echo message="Target File : ${pyfile}.py"/>
        <echo message="Target Dir : ${target.dir}\${pyfile}"/>
        <echo message="Library File : ${pyfile}.zip"/>
       
        <exec executable="${ppython.exe}" failonerror="yes">
                <arg value="-OO"/>
                <arg value="${py2exeHelper}"/>
                <arg value="-p ${panda.dir}"/>
                <arg value="-r ${src.dir}"/>
                <arg value="-f ${pyfile}.py"/>
                <arg value="-d ${target.dir}\${pyfile}"/>
                <arg value="-l ${pyfile}.zip"/>
                <redirector output="${log.dir}/${pyfile}/${pyfile}.out.txt"
                            error="${log.dir}/${pyfile}/${pyfile}.err.txt">
                </redirector>

        </exec>
    </target>
</project>
aaronbstjohn
 
Posts: 42
Joined: Sat Sep 30, 2006 8:18 pm


Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest