Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 57 lines (42 sloc) 1.27 KB
#! /usr/bin/env python
import sys, os, subprocess, struct
def bits():
"""determine if running on a 32 bit or 64 bit platform
"""
return struct.calcsize("P") * 8
if bits() == 32:
pyversions = "24 25 26 27 30 31 32"
else:
pyversions = "27 30 31 32"
executables = [(x, "C:\\Python%s\\python.exe" % x) for x in pyversions.split()]
def system(cmd):
sys.stdout.write("====> Running %s\n" % cmd)
popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
nl = True
while 1:
char = popen.stdout.read(1)
if not char:
break
if nl:
sys.stdout.write(" ")
sys.stdout.write(char)
sys.stdout.flush()
nl = char == "\n"
st = popen.wait()
if st != 0:
sys.exit("Error: command %r failed" % cmd)
sys.stdout.write("\n")
def main():
upload = ""
if sys.argv[1:] == ["upload"]:
upload = "upload"
for v, x in executables:
if not os.path.exists(x):
continue
for dist in ["bdist_egg", "bdist_wininst"]:
if (v, dist) == ("24", "bdist_msi"):
continue
cmd = "%s setup.py -q %s %s" % (x, dist, upload)
system(cmd)
if __name__ == "__main__":
main()