import os
import sys
import errno
import tarfile
import urllib
import shutil
TMP="/tmp/tmp-build"
BASE=os.path.dirname(sys.argv[0])
if BASE == "" or BASE == ".":
BASE = os.getcwd()
THIRD = BASE + "/wsgikit/3rd-party"
def basename(filename, ext):
try:
i = filename.index(ext)
base = filename[0:i]
except ValueError:
base = filename
pass
return base
def mkdirs(dirname, mode=0777):
# Python Cookbook Recipe edition 1 4.17
try:
os.makedirs(dirname)
except OSError, err:
if err.errno != errno.EEXIST or not os.path.isdir(TMP):
raise
def get_file(zip_type, filename, url):
print "Getting %s ..." % filename
mkdirs(TMP)
os.chdir(TMP)
# TODO: check for existing package, download if not there
urllib.urlretrieve(url, filename)
DIR=basename(filename, ".tar.gz")
DIR=basename(DIR, ".tar.bz2")
DIR=basename(DIR, ".tgz")
tar = tarfile.open(filename, "r:" + zip_type)
for file in tar.getnames():
tar.extract(file)
try:
os.chdir(DIR)
except OSError:
pass
def installer(name):
mkdirs(THIRD + "/" + name +"-files")
cmd = 'python setup.py install -f --install-lib="%s/%s-files" --install-scripts="%s/%s-files/scripts" --no-compile' % (THIRD, name, THIRD, name)
os.system(cmd)
get_file("gz","WSGI Utils-0.5.tar.gz",
"http://www.owlfish.com/software/wsgiutils/downloads/WSGI%20Utils-0.5.tar.gz")
installer("wsgiutils")
get_file("gz", "Component-0.1.tar.gz",
"http://webwareforpython.org/downloads/Component-0.1.tar.gz")
mkdirs(THIRD + "/Component-files")
DEST = THIRD + "/Component-files/Component"
shutil.rmtree(DEST,ignore_errors=1)
try:
shutil.move(TMP + "/Component-0.1", DEST)
except OSError:
pass
get_file("gz", "ZPTKit-0.1.tar.gz",
"http://imagescape.com/software/ZPTKit/ZPTKit-0.1.tar.gz")
mkdirs(THIRD + "/ZPTKit-files")
DEST = THIRD + "/ZPTKit-files/ZPTKit"
shutil.rmtree(DEST,ignore_errors=1)
try:
shutil.move(TMP + "/ZPTKit-0.1", DEST)
except OSError:
# To handle permission errors under Windows
pass
get_file("gz", "ZopePageTemplates-1.4.0.tar.gz",
"http://belnet.dl.sourceforge.net/sourceforge/zpt/ZopePageTemplates-1.4.0.tgz")
os.chdir("ZopePageTemplates")
installer("ZopePageTemplates")
get_file("gz", "scgi-1.2.tar.gz",
"http://www.mems-exchange.org/software/files/scgi/scgi-1.2.tar.gz")
installer("scgi")
cmd ="svn co http://svn.colorstudy.com/trunk/SQLObject %s/SQLObject" % TMP
os.system(cmd)
os.chdir(TMP + "/SQLObject")
installer("sqlobject")
mkdirs(THIRD + "/sqlobject-files/scripts")
shutil.copy(TMP + "/SQLObject/scripts/sqlobject-admin",
THIRD + "/sqlobject-files/scripts")
urllib.urlretrieve("http://bellsouthpwp.net/m/e/mefjr75/python/PySourceColor.py",
TMP + "/PySourceColor.py")
mkdirs(THIRD + "/PySourceColor-files")
shutil.copy(TMP + "/PySourceColor.py", THIRD + "/PySourceColor-files")
I am an "old" computer engineer & programmer, not old enough to have a punch card story but old enough to - have owned a Zx-81 - programmed in Motorola 6809 assembler - remember when 64K was lots of RAM - fixed a hard disk by replacing the platter
Sunday, April 17, 2005
Installing WSGIKit on a Win32 platform
So I could have a play with WSGIKit and look at how I could make ISAPI_WSGI work with it, I decided to install it on my home Windows XP box. As part of the svn checkout, there is a shell script called build-pkg which will download the required third party packages and install them under WSGIKit for you. Tried to run the script with a standard install of Cygwin but it failed due to various errors. I could have debugged my way thru the errors but thought why not create a truly cross-platform version of buld-pkg in python. So an hour later, the following script did the job for me. It currently lacks the checks to see if the package has already been downloaded, but it did the job for me.
Labels:
wsgi
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment