summaryrefslogtreecommitdiff
path: root/java/makedist.py
blob: 68889fa02c6798f66e38fb9130806b9c66a981f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2002
# ZeroC, Inc.
# Billerica, MA, USA
#
# All Rights Reserved.
#
# Ice is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# **********************************************************************

import os, sys, fnmatch, re

#
# Remove a file or directory (recursive).
#
def rm(path):
    if os.path.isdir(path) and not os.path.islink(path):
        for x in os.listdir(path):
            rm(os.path.join(path, x))
        os.rmdir(path)
    else:
        os.remove(path)

#
# Check arguments
#
tag = "-rHEAD"
for x in sys.argv[1:]:
    if x == "-h":
        print "usage: " + sys.argv[0] + " [-h] [tag]"
        sys.exit(0)
    else:
        tag = "-r" + x

#
# Remove any existing "dist" directory and create a new one.
#
if os.path.exists("dist"):
    rm("dist")
os.mkdir("dist")
os.chdir("dist")

#
# Export sources from CVS.
#
os.system("cvs -z5 -d cvs.mutablerealms.com:/home/cvsroot export " + tag + " icej")

#
# Remove files.
#
filesToRemove = [ \
    "makedist.py", \
    ]
for x in filesToRemove:
    rm(x)

#
# Get Ice version.
#
config = open("icej/src/IceUtil/Version.java", "r")
version = re.search("ICE_STRING_VERSION = \"(.*)\"", config.read()).group(1)

#
# Create archives.
#
icever = "IceJ-" + version
os.mkdir(icever)
os.rename("icej", os.path.join(icever, "icej"))
os.system("tar cvzf " + icever + ".tar.gz " + icever)
os.system("zip -9 -r " + icever + ".zip " + icever)

#
# Copy files (README, etc.).
#

#
# Done.
#
rm(icever)