Look at the p4 client spec, create a View() object that contains all the mappings, and return it.
()
| 1375 | |
| 1376 | |
| 1377 | def getClientSpec(): |
| 1378 | """Look at the p4 client spec, create a View() object that contains |
| 1379 | all the mappings, and return it. |
| 1380 | """ |
| 1381 | |
| 1382 | specList = p4CmdList(["client", "-o"]) |
| 1383 | if len(specList) != 1: |
| 1384 | die('Output from "client -o" is %d lines, expecting 1' % |
| 1385 | len(specList)) |
| 1386 | |
| 1387 | # dictionary of all client parameters |
| 1388 | entry = specList[0] |
| 1389 | |
| 1390 | # the //client/ name |
| 1391 | client_name = entry["Client"] |
| 1392 | |
| 1393 | # just the keys that start with "View" |
| 1394 | view_keys = [k for k in entry.keys() if k.startswith("View")] |
| 1395 | |
| 1396 | # hold this new View |
| 1397 | view = View(client_name) |
| 1398 | |
| 1399 | # append the lines, in order, to the view |
| 1400 | for view_num in range(len(view_keys)): |
| 1401 | k = "View%d" % view_num |
| 1402 | if k not in view_keys: |
| 1403 | die("Expected view key %s missing" % k) |
| 1404 | view.append(entry[k]) |
| 1405 | |
| 1406 | return view |
| 1407 | |
| 1408 | |
| 1409 | def getClientRoot(): |