From 9f3ede5c30228dd335d35e839f7a2e63c2ff43c7 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Thu, 17 Jul 2008 21:46:55 +0200 Subject: [PATCH] Added a way to specify the path to use instead of the default Now it is possible to specify the path to use as a third argument to setupRepo.py. --- src/scripts/setupRepo.py | 57 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/src/scripts/setupRepo.py b/src/scripts/setupRepo.py index f42cb8d..aaa2e11 100755 --- a/src/scripts/setupRepo.py +++ b/src/scripts/setupRepo.py @@ -564,21 +564,27 @@ def main(args): repository. If both should be created then the size of args should be 1. When the third argument is 'path', instead of creating the repository the path where it - will be created is printed. The first element in the + will be created is printed. If there is a fourth + argument it is interpreted as the path where the + repository should be created. The first element in the array is always ignored. Returns: 0 upon success, or nonzero upon failure. """ + global testPath + global metricsPath + size = len(args) def printUsage(): str = "Please specify either 'test', 'metrics', or nothing to run both." \ - "\nSuffix with 'path' to print the path where the repo will be created" + "\nSuffix with 'path' to print the path where the repo will be created." \ + "\nAs third argument you may provide the path to create the repo in." print(str) - if size > 3: + if size > 4: printUsage() return 129 @@ -587,25 +593,54 @@ def main(args): printUsage() return 129 - if size > 1: - if args[1] != "test" and args[1] != "metrics": - printUsage() - return 129 + createTestRepo = False + createMetricsRepo = False + printTestRepoPath = False + printMetricsRepoPath = False + + if size == 1: + createTestRepo = True + createMetricsRepo = True + + if size == 2 or size == 4: + if args[1] == "test": + createTestRepo = True + + if args[1] == "metrics": + createMetricsRepo = True + + if size == 3: + if args[1] == "test": + printTestRepoPath = True + + if args[1] == "metrics": + printMetricsRepoPath = True + + if not createTestRepo and not createMetricsRepo \ + and not printTestRepoPath and not printMetricsRepoPath: + printUsage() + return 129 + + if createTestRepo: + if size == 4: + testPath = args[3] - if size == 1 or (size == 2 and args[1] == "test"): ret = createTestRepository() if ret != 0: return ret - if size == 1 or (size == 2 and args[1] == "metrics"): + if createMetricsRepo: + if size == 4: + metricsPath = args[3] + ret = createMetricsRepository() if ret != 0: return ret - if size == 3 and args[1] == "test": + if printTestRepoPath: print(testPath) - if size == 3 and args[1] == "metrics": + if printMetricsRepoPath: print(metricsPath) return 0 -- 2.11.4.GIT