about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-08-04 22:51:41 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-08-04 22:51:41 +0000
commit34291e79bd57a9a8f2b94b6d636d3dda3e6f3fd8 (patch)
tree22cc6f091445d2f5f161ae78d8df042ce89a6905 /scripts
parent56362977e33f753caf03ebc1e099715d7b597518 (diff)
downloadzcatch-34291e79bd57a9a8f2b94b6d636d3dda3e6f3fd8.tar.gz
zcatch-34291e79bd57a9a8f2b94b6d636d3dda3e6f3fd8.zip
added make release scripts
Diffstat (limited to 'scripts')
-rw-r--r--scripts/deploy_win.py30
-rw-r--r--scripts/make_release.py58
2 files changed, 58 insertions, 30 deletions
diff --git a/scripts/deploy_win.py b/scripts/deploy_win.py
deleted file mode 100644
index 3015ba5a..00000000
--- a/scripts/deploy_win.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import zipfile

-import os, os.path

-from distutils.file_util import copy_file

-

-# A bit of dir trickery to make sure we're referring to the right dir

-# this makes it possible to run the script both from the teewars root and

-# the scripts subdir

-if os.getcwd().find("scripts") > -1:

-    dir = os.path.abspath("..")

-else:

-    dir = os.getcwd()

-

-data_dir = "%s\\%s" % (dir, 'data')

-exe_file = "%s\\%s" % (dir, 'teewars.exe')

-zip_file = "%s\\%s" % (dir, 'teewars.zip')

-

-ns = os.listdir(data_dir)

-try:

-    ns.remove('.svn')

-except:

-    pass

-zf = zipfile.ZipFile(zip_file, 'w', zipfile.ZIP_DEFLATED)

-zf.write(exe_file, 'teewars.exe')

-for n in ns:

-    zf.write(os.path.join(data_dir, n), "%s\\%s" % ('data', n))

-

-print "Data written to zip-file:\n"

-zf.printdir()

-zf.close()

-

diff --git a/scripts/make_release.py b/scripts/make_release.py
new file mode 100644
index 00000000..f0985de5
--- /dev/null
+++ b/scripts/make_release.py
@@ -0,0 +1,58 @@
+import shutil, os, sys, zipfile
+
+valid_platforms = ["win32", "linux86", "linux86_64"]
+
+if len(sys.argv) != 3:
+	print "wrong number of arguments"
+	print sys.argv[0], "VERSION PLATFORM"
+	sys.exit(-1)
+
+name = "teewars"
+version = sys.argv[1]
+platform = sys.argv[2]
+exe_ext = ""
+use_zip = 0
+
+if not platform in valid_platforms:
+	print "not a valid platform"
+	print valid_platforms
+	sys.exit(-1)
+
+if platform == 'win32':
+	exe_ext = ".exe"
+	use_zip = 1
+
+def copydir(src, dst):
+	for root, dirs, files in os.walk(src, topdown=True):
+		if "/." in root:
+			continue
+		for name in dirs:
+			if name[0] != '.':
+				os.mkdir(os.path.join(dst, root, name))
+		for name in files:
+			if name[0] != '.':
+				shutil.copy(os.path.join(root, name), os.path.join(dst, root, name))
+				
+package = "%s-%s-%s" %(name, version, platform)
+package_dir = package
+
+shutil.rmtree(package_dir, True)
+os.mkdir(package_dir)
+os.mkdir(os.path.join(package_dir, "data"))
+copydir("data", package_dir)
+shutil.copy("readme.txt", package_dir)
+
+shutil.copy("teewars"+exe_ext, package_dir)
+shutil.copy("teewars_srv"+exe_ext, package_dir)
+
+if use_zip:
+	zf = zipfile.ZipFile("%s.zip" % package, 'w', zipfile.ZIP_DEFLATED)
+	
+	for root, dirs, files in os.walk(package_dir, topdown=True):
+		for name in files:
+			n = os.path.join(root, name)
+			zf.write(n, n)
+	zf.printdir()
+	zf.close()
+else:
+	os.system("tar czvf %s.tar.gz %s" % (package, package_dir))