makeExe.py

Premshree Pillai premshree_python@yahoo.co.in
Sun, 25 Jan 2004 12:53:23 +0000 (GMT)


Wrote a simple Python script that makes life a wee bit
easier when using py2exe:

Also available at
http://premshree.resource-locator.com/python/makeExe.py

"""
makeExe.py
- Simple Python script to automate the creation
  of Python executables using py2exe.

(c) 2004 Premshree Pillai (24/01/04)
http://www.qiksearch.com/
"""

## Run this file from Python root dir

import sys
import re

fileName = raw_input("Enter file name (rel or abs
path, eg., python/file.py): ")

package = re.split(":",fileName)
package = re.split("/",package[len(package) - 1])
package = re.split(".py",package[len(package) - 1])
package = package[0]

fp = open("setup.py","w")
temp = """from distutils.core import setup
import py2exe
setup(name = "%s",
     scripts = ["%s"],
)""" % (package,fileName)
fp.write(temp)
fp.close()

sys.argv.append("py2exe")
execfile("setup.py")

fp = open("setup.py","w")
temp = ""
fp.write(temp)
fp.close()

print "\n", "Executable created!"
print "Press <enter> to exit..."
if(raw_input()):
	exit


=====
-Premshree
[http://www.qiksearch.com/]

________________________________________________________________________
Yahoo! India Mobile: Download the latest polyphonic ringtones.
Go to http://in.mobile.yahoo.com