@@ -6,26 +6,29 @@ class PlanSpecs:
66 """ Simple class to read in the plan specifications from a CSV file.
77 """
88
9- def __init__ (self ,basedir ,networkdir ,plansubdir ,projectsubdir = None ,tag = None ,tempdir = None , ** kwargs ):
9+ def __init__ (self ,champVersion , basedir ,networkdir ,plansubdir ,projectsubdir = None ,tag = None ,tempdir = None , ** kwargs ):
1010 """
1111 Read specs file, check out projects and check the network type and project year
1212 """
13- self .projects = [] # list of projects included in the plan
14- self .projectdict = {} # plan name => dictionary of attributes
15- self .network = Network (champVersion = "4.3" ,
16- networkBaseDir = basedir ,
17- networkPlanSubdir = plansubdir ,
18- networkProjectSubdir = projectsubdir )
13+ self .projects = [] # list of projects included in the plan
14+ self .projectdict = {} # plan name => dictionary of attributes
15+ #network is necessary to check out projects
16+ self .network = Network (champVersion = champVersion ,
17+ networkBaseDir = basedir ,
18+ networkPlanSubdir = plansubdir ,
19+ networkProjectSubdir = projectsubdir )
20+ self .plan_tag = None
21+ self .override = []
1922
20- specs = open (os .path .join (basedir ,plansubdir ,networkdir ,'planSpecs.csv' ),'r' )
23+ specs = open (os .path .join (tempdir ,plansubdir ,networkdir ,'planSpecs.csv' ),'r' )
2124 i = 0
2225 for line in specs :
2326 i += 1
2427 if i == 1 :
2528 header = line .strip ().split (',' )
2629 else :
2730 l = line .strip ().split (',' )
28- #print l
31+
2932 project_name = l [header .index ("projectname" )]
3033 projType = l [header .index ("type" )]
3134 self .projectdict [project_name ] = {}
@@ -35,18 +38,19 @@ def __init__(self,basedir,networkdir,plansubdir,projectsubdir=None,tag=None,temp
3538 self .projectdict [project_name ]["projtype" ]= projType
3639 if kwargs :
3740 self .projectdict [project_name ]["kwargs" ]= kwargs
38- else :
39- print "kwargs not coming through." , kwargs
40- assert (1 == 2 )
41-
41+ if 'plan_tag' in kwargs .keys ():
42+ plan_tag = kwargs ['plan_tag' ]
43+ if 'override' in kwargs .keys ():
44+ override = kwargs ['override' ]
45+
4246 # if project = "dir1/dir2" assume dir1 is git, dir2 is the projectsubdir
43- (head ,tail ) = os .path .split (os . path . join ( networkdir , project_name ) )
47+ (head ,tail ) = os .path .split (project_name )
4448 if head :
45- applied_SHA1 = self .network .cloneAndApplyProject (networkdir = head , projectsubdir = tail , tag = tag ,
49+ applied_SHA1 = self .network .cloneProject (networkdir = head , projectsubdir = tail , tag = tag ,
4650 projtype = projType , tempdir = tempdir )
4751 self .projectdict [project_name ]["nettypes" ]= self .network .getNetTypes (tempdir ,head ,tail )
4852 else :
49- applied_SHA1 = self .network .cloneAndApplyProject (networkdir = project_name , tag = tag ,
53+ applied_SHA1 = self .network .cloneProject (networkdir = project_name , tag = tag ,
5054 projtype = projType , tempdir = tempdir )
5155 self .projectdict [project_name ]["nettypes" ]= self .network .getNetTypes (tempdir ,project_name )
5256
@@ -68,8 +72,6 @@ def listOfProjects(self,netType='hwy'):
6872
6973 for proj in self .projects :
7074 if netType in self .projectdict [proj ]['nettypes' ]:
71- print "proj: " , proj
72- print "projAsDict: " , self .projectAsDict (proj )
7375 projectlist .append (self .projectAsDict (proj ))
7476 return projectlist
7577
0 commit comments