Issue #7042: Use a better mechanism for testing timers in test_signal.
[python.git] / Demo / pdist / rcsclient.py
blobd8cb004b2f3f7e2b37be3fd056f6a540182ed6f6
1 """Customize this file to change the default client etc.
3 (In general, it is probably be better to make local operation the
4 default and to require something like an RCSSERVER environment
5 variable to enable remote operation.)
7 """
9 import string
10 import os
12 # These defaults don't belong here -- they should be taken from the
13 # environment or from a hidden file in the current directory
15 HOST = 'voorn.cwi.nl'
16 PORT = 4127
17 VERBOSE = 1
18 LOCAL = 0
20 import client
23 class RCSProxyClient(client.SecureClient):
25 def __init__(self, address, verbose = client.VERBOSE):
26 client.SecureClient.__init__(self, address, verbose)
29 def openrcsclient(opts = []):
30 "open an RCSProxy client based on a list of options returned by getopt"
31 import RCSProxy
32 host = HOST
33 port = PORT
34 verbose = VERBOSE
35 local = LOCAL
36 directory = None
37 for o, a in opts:
38 if o == '-h':
39 host = a
40 if ':' in host:
41 i = string.find(host, ':')
42 host, p = host[:i], host[i+1:]
43 if p:
44 port = string.atoi(p)
45 if o == '-p':
46 port = string.atoi(a)
47 if o == '-d':
48 directory = a
49 if o == '-v':
50 verbose = verbose + 1
51 if o == '-q':
52 verbose = 0
53 if o == '-L':
54 local = 1
55 if local:
56 import RCSProxy
57 x = RCSProxy.RCSProxyLocal()
58 else:
59 address = (host, port)
60 x = RCSProxyClient(address, verbose)
61 if not directory:
62 try:
63 directory = open(os.path.join("CVS", "Repository")).readline()
64 except IOError:
65 pass
66 else:
67 if directory[-1] == '\n':
68 directory = directory[:-1]
69 if directory:
70 x.cd(directory)
71 return x