On Feb 22, 2006, at 11:21 AM, Jimmy Retzlaff wrote:
> Yaroslav Samchuk wrote:
>> On 22 Feb 2006, at 21:03, Stephen Gross wrote:
>>> Hi folks... I've been trying to figure out a good way to bundle
>>> together a
>>> py2exe 'dist' directory into a single-file executable. A lot of
>>> people have
>>> suggested NSIS as a solution, but I've got an easier one: winrar.
>
> This is actually very similar to my understanding of what PyInstaller
> (formerly McMillan) is doing. And Steve is right that it is much
> simpler
> than the NSIS idea I have pushed in the past (which also uses the same
> approach).
I don't understand what the issue with NSIS is? I've been using it
do to a single-file executable for a very long time. All I did was
slightly modify the instructions that were in the wiki, and I was
good to go. There really wasn't anything to it, and all of the
components are free and open source. The only application specific
information is the name of the icon and the name of the exe file, but
that's all I can see. Hell, someone could make a setuptools or
distutils command that calls nsis using the exe name and such from
py2exe.. wouldn't be very hard as far as hacking distutils goes.
Here's the end of my build script (after "python setup.py py2exe" is
run):
import os
BUILD_NSIS = True
NSIS = 'C:\\Progra~1\\NSIS\\makensis.exe'
# note that the subprocess module or os.spawn*
# would probably be a better choice, not sure why I used os.system
def cmd(cmd, *args):
s = cmd + ' ' + ' '.join(['"%s"'] * len(args)) % args
print s
return os.system(s)
if BUILD_NSIS:
cmd(NSIS, "setup.nsi")
Here's what my setup.nsis looks like:
!define py2exeOutputDir 'dist'
!define exe 'installtk.exe'
!define icon 'TPWinstaller.ico'
!define compressor 'lzma' ;one of 'zlib', 'bzip2', 'lzma'
; - - - - do not edit below this line, normaly - - - -
!ifdef compressor
SetCompressor ${compressor}
!else
SetCompress Off
!endif
Name ${exe}
OutFile ${exe}
SilentInstall silent
CRCCheck off
!ifdef icon
Icon ${icon}
!endif
Section
InitPluginsDir
SetOutPath '$PLUGINSDIR'
File /r '${py2exeOutputDir}\*.*'
SetOutPath '$EXEDIR' ; uncomment this line to start the
exe in the PLUGINSDIR
nsExec::Exec $PLUGINSDIR\${exe}
SectionEnd
|