py2exe and setuptools w/ install_requires

Hi, I have several apps that I distribute to customers using py2exe. I have also written modules which these apps share. Up to now I have not had any modules written in C so to build my py2exe apps I just set the PYTHONPATH environment variable to point to the module's location in CVS and run setup.py py2exe. This is convenient because release builds are done via Buildbot on a dedicated computer. All buildbot has to do is check out the source and run setup.py. I now have my first C module and have been trying to work out how to deal with building the module. I would prefer to build the module and 'release' it for use with my two apps. What I would like to do is build up an egg for the library and copy it to a known location. Then have the apps use the setuptools require_install directive to allow me to get the egg and 'install' it into the build directory somewhere and then let the rest of the py2exe magic work. I think I know where to add my call into setuptools from py2exe, but I cannot figure out what setup_tools function to call in order to do the 'installation'. Any help in executing my plan or in telling me I am a morron because there is some easier way to do this would be much appreciated. -Chris

At 06:25 PM 01/19/2006 -0500, Chris Lambacher wrote:
Hi,
I have several apps that I distribute to customers using py2exe. I have also written modules which these apps share. Up to now I have not had any modules written in C so to build my py2exe apps I just set the PYTHONPATH environment variable to point to the module's location in CVS and run setup.py py2exe. This is convenient because release builds are done via Buildbot on a dedicated computer. All buildbot has to do is check out the source and run setup.py.
I now have my first C module and have been trying to work out how to deal with building the module. I would prefer to build the module and 'release' it for use with my two apps.
What I would like to do is build up an egg for the library and copy it to a known location. Then have the apps use the setuptools require_install directive to allow me to get the egg and 'install' it into the build directory somewhere and then let the rest of the py2exe magic work.
I think I know where to add my call into setuptools from py2exe, but I cannot figure out what setup_tools function to call in order to do the 'installation'.
Run "setup.py develop" in the source tree of each project, starting with the dependencies and working your way up to the main application. Then run py2exe. See also the py2exe Wiki, which has a page of tips for using py2exe with eggs. However, if you have source checkouts for all the things your application includes, you don't need to worry about unzipping eggs. Note that this will *not* include egg metadata in your .exe build, so if you are using packages that require such metadata, they may not work correctly when embedded.

On Fri, Jan 20, 2006 at 12:35:56PM -0500, Phillip J. Eby wrote:
At 06:25 PM 01/19/2006 -0500, Chris Lambacher wrote:
Hi,
I have several apps that I distribute to customers using py2exe. I have also written modules which these apps share. Up to now I have not had any modules written in C so to build my py2exe apps I just set the PYTHONPATH environment variable to point to the module's location in CVS and run setup.py py2exe. This is convenient because release builds are done via Buildbot on a dedicated computer. All buildbot has to do is check out the source and run setup.py.
I now have my first C module and have been trying to work out how to deal with building the module. I would prefer to build the module and 'release' it for use with my two apps.
What I would like to do is build up an egg for the library and copy it to a known location. Then have the apps use the setuptools require_install directive to allow me to get the egg and 'install' it into the build directory somewhere and then let the rest of the py2exe magic work.
I think I know where to add my call into setuptools from py2exe, but I cannot figure out what setup_tools function to call in order to do the 'installation'.
Run "setup.py develop" in the source tree of each project, starting with the dependencies and working your way up to the main application. Then run py2exe.
See also the py2exe Wiki, which has a page of tips for using py2exe with eggs. However, if you have source checkouts for all the things your application includes, you don't need to worry about unzipping eggs. This is almost what I want, but I want to release my modules and have my app builds pick them up as eggs.
When I build my module eggs, I publish them to a directory that an http server indexes. I then I have a build script that calls 'easy_install -m -Z -d tmpdir -f http://myserver/eggs module' for each module that I am interested in. Then I add all the new directories in tmpdir to my python path and call setup.py py2exe. The advantage of this is that each time I build I could potentially be using a different version of the module. I don't have to worry about not getting updates to that libarary because I am building a point release of my app on some strange branch. I wanted to make this action triggered by install_requires in the py2exe command, I am instead doing this externally before the py2exe command.
Note that this will *not* include egg metadata in your .exe build, so if you are using packages that require such metadata, they may not work correctly when embedded.
Not a problem for me, I am not that sofisticated yet :) Thanks for the help, Chris

At 02:58 PM 1/20/2006 -0500, Chris Lambacher wrote:
When I build my module eggs, I publish them to a directory that an http server indexes. I then I have a build script that calls 'easy_install -m -Z -d tmpdir -f http://myserver/eggs module' for each module
Note that easy_install now supports using -f with a directory name, so you don't need to have it do an HTTP fetch; just use the local directory path instead of the http: URL.
that I am interested in. Then I add all the new directories in tmpdir to my python path and call setup.py py2exe.
FYI, if you configure the egg directory to be a "site" directory, you won't need to add them to sys.path manually. See: http://peak.telecommunity.com/DevCenter/EasyInstall#administrator-installati... and replace all the '~/lib/python2.3' references with your desired tmpdir. Then, when you easy_install the eggs to the tmpdir, they will get put on sys.path automatically.
The advantage of this is that each time I build I could potentially be using a different version of the module. I don't have to worry about not getting updates to that libarary because I am building a point release of my app on some strange branch.
I wanted to make this action triggered by install_requires in the py2exe command, I am instead doing this externally before the py2exe command.
That's going to have to wait until setuptools is more directly integrated with py2exe. At some point, it should be possible for py2exe to just swallow all the needed eggs into the library zipfile, after automatically updating. But that's not going to happen for a while yet.

On Thu, Jan 26, 2006 at 04:23:44PM -0500, Phillip J. Eby wrote:
At 02:58 PM 1/20/2006 -0500, Chris Lambacher wrote:
When I build my module eggs, I publish them to a directory that an http server indexes. I then I have a build script that calls 'easy_install -m -Z -d tmpdir -f http://myserver/eggs module' for each module
Note that easy_install now supports using -f with a directory name, so you don't need to have it do an HTTP fetch; just use the local directory path instead of the http: URL.
I tried to use this and it then did not seem to honor -d tmpdir, it just tried to add the egg in place to the path.
that I am interested in. Then I add all the new directories in tmpdir to my python path and call setup.py py2exe.
FYI, if you configure the egg directory to be a "site" directory, you won't need to add them to sys.path manually. See:
http://peak.telecommunity.com/DevCenter/EasyInstall#administrator-installati...
and replace all the '~/lib/python2.3' references with your desired tmpdir. Then, when you easy_install the eggs to the tmpdir, they will get put on sys.path automatically.
I specifically don't want to do this because I don't actually want the package installed, I just want it in the path for the duration of the call to setup.py py2exe Note that I can't just install it and then uninstall it because there could be more than one build happening at the same time, each wanting a different version of the item being installed.
The advantage of this is that each time I build I could potentially be using a different version of the module. I don't have to worry about not getting updates to that libarary because I am building a point release of my app on some strange branch.
I wanted to make this action triggered by install_requires in the py2exe command, I am instead doing this externally before the py2exe command.
That's going to have to wait until setuptools is more directly integrated with py2exe. At some point, it should be possible for py2exe to just swallow all the needed eggs into the library zipfile, after automatically updating. But that's not going to happen for a while yet.
------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Py2exe-users mailing list Py2exe-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/py2exe-users
participants (2)
-
Chris Lambacher
-
Phillip J. Eby