Package glue :: Module git_version
[hide private]
[frames] | no frames]

Source Code for Module glue.git_version

 1  id = "8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5" 
 2  date = "2017-12-05 15:29:36 +0000" 
 3  branch = "None" 
 4  tag = "None" 
 5  if tag == "None": 
 6      tag = None 
 7  author = "Chris Pankow <chris.pankow@ligo.org>" 
 8  builder = "Unknown User <>" 
 9  committer = "Chris Pankow <chris.pankow@ligo.org>" 
10  status = "CLEAN: All modifications committed" 
11  version = id 
12  verbose_msg = """Branch: None 
13  Tag: None 
14  Id: 8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5 
15   
16  Builder: Unknown User <> 
17  Build date: 2017-12-12 06:34:08 +0000 
18  Repository status: CLEAN: All modifications committed""" 
19   
20  import warnings 
21   
22 -class VersionMismatchError(ValueError):
23 pass
24
25 -def check_match(foreign_id, onmismatch="raise"):
26 """ 27 If foreign_id != id, perform an action specified by the onmismatch 28 kwarg. This can be useful for validating input files. 29 30 onmismatch actions: 31 "raise": raise a VersionMismatchError, stating both versions involved 32 "warn": emit a warning, stating both versions involved 33 """ 34 if onmismatch not in ("raise", "warn"): 35 raise ValueError(onmismatch + " is an unrecognized value of onmismatch") 36 if foreign_id == "8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5": 37 return 38 msg = "Program id (8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5) does not match given id (%s)." % foreign_id 39 if onmismatch == "raise": 40 raise VersionMismatchError(msg) 41 42 # in the backtrace, show calling code 43 warnings.warn(msg, UserWarning)
44