LAL  7.2.4.1-a4c2ad8
git_version.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # git_version.py - vcs information module
3 #
4 # Copyright (C) 2010 Nickolas Fotopoulos
5 # Copyright (C) 2012-2013 Adam Mercer
6 # Copyright (C) 2016 Leo Singer
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or (at
11 # your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with with program; see the file COPYING. If not, write to the
20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 # MA 02110-1301 USA
22 
23 id = "a4c2ad86821a19add41801f3d7637f5f456038c5"
24 date = "2022-10-2 06:34:38 +0000"
25 branch = "None"
26 tag = "None"
27 if tag == "None":
28  tag = None
29 author = "Karl Wette <karl.wette@ligo.org>"
30 builder = "Unknown User <>"
31 committer = "Karl Wette <karl.wette@ligo.org>"
32 status = "CLEAN: All modifications committed"
33 version = id
34 verbose_msg = """Branch: None
35 Tag: None
36 Id: a4c2ad86821a19add41801f3d7637f5f456038c5
37 
38 Builder: Unknown User <>
39 Repository status: CLEAN: All modifications committed"""
40 
41 import warnings
42 
43 class VersionMismatchError(ValueError):
44  pass
45 
46 def check_match(foreign_id, onmismatch="raise"):
47  """
48  If foreign_id != id, perform an action specified by the onmismatch
49  kwarg. This can be useful for validating input files.
50 
51  onmismatch actions:
52  "raise": raise a VersionMismatchError, stating both versions involved
53  "warn": emit a warning, stating both versions involved
54  """
55  if onmismatch not in ("raise", "warn"):
56  raise ValueError(onmismatch + " is an unrecognized value of onmismatch")
57  if foreign_id == "a4c2ad86821a19add41801f3d7637f5f456038c5":
58  return
59  msg = "Program id (a4c2ad86821a19add41801f3d7637f5f456038c5) does not match given id (%s)." % foreign_id
60  if onmismatch == "raise":
61  raise VersionMismatchError(msg)
62 
63  # in the backtrace, show calling code
64  warnings.warn(msg, UserWarning)
def check_match(foreign_id, onmismatch="raise")
If foreign_id != id, perform an action specified by the onmismatch kwarg.
Definition: git_version.py:54