LAL 7.6.1.1-4859cae
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
23id = "4859cae3740ac4c18bdea787a91f31c542632df1"
24date = "2025-04-23 14:30:46 +0000"
25branch = "None"
26tag = "None"
27if tag == "None":
28 tag = None
29author = "Karl Wette <karl.wette@ligo.org>"
30builder = "Unknown User <>"
31committer = "Karl Wette <karl.wette@ligo.org>"
32status = "CLEAN: All modifications committed"
33version = id
34verbose_msg = """Branch: None
35Tag: None
36Id: 4859cae3740ac4c18bdea787a91f31c542632df1
37
38Builder: Unknown User <>
39Repository status: CLEAN: All modifications committed"""
40
41import warnings
42
43class VersionMismatchError(ValueError):
44 pass
45
46def 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 == "4859cae3740ac4c18bdea787a91f31c542632df1":
58 return
59 msg = "Program id (4859cae3740ac4c18bdea787a91f31c542632df1) 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