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