ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/getsrm
Revision: 1.1
Committed: Thu Oct 20 23:16:23 2011 UTC (13 years, 6 months ago) by paus
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, HEAD
Branch point for: Mit_025c_branch
Log Message:
Adjusting....

File Contents

# Content
1 #!/usr/bin/env python
2 #---------------------------------------------------------------------------------------------------
3 # Script to convert a simple directoryinto the full srm target URL.
4 #
5 # Author: C.Paus (Oct 05, 2011)
6 #---------------------------------------------------------------------------------------------------
7 import getopt,sys,os,srm
8
9 #===================================================================================================
10 # Main starts here
11 #===================================================================================================
12 # Define string to explain usage of the script
13 usage = " Usage: getsrm --debug\n"
14 usage += " --help\n"
15
16 # Define the valid options which can be specified and check out the command line
17 valid = ['debug','help']
18 try:
19 opts, args = getopt.getopt(sys.argv[1:], "", valid)
20 except getopt.GetoptError, ex:
21 print usage
22 print str(ex)
23 sys.exit(1)
24
25 # --------------------------------------------------------------------------------------------------
26 # Get all parameters for the production
27 # --------------------------------------------------------------------------------------------------
28 # Set defaults for each option
29 debug = False
30 # Read new values from the command line
31 for opt, arg in opts:
32 if opt == '--help':
33 print usage
34 sys.exit(0)
35 if opt == '--debug':
36 debug = True
37
38 # Test whether the directory exists and then proceed
39 for dir in sys.argv[1:]:
40 if dir[:2] == "--":
41 continue
42 if debug:
43 print "\nProcessing: " + dir + "\n"
44 storageUrl = srm.convertToUrl(dir,debug)
45
46 print storageUrl