second try
[vsorcdistro/.git] / ryu / .eggs / pbr-5.3.1-py2.7.egg / pbr / options.py
1 # Licensed under the Apache License, Version 2.0 (the "License");
2 # you may not use this file except in compliance with the License.
3 # You may obtain a copy of the License at
4 #
5 #    http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10 # implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 #
14 # Copyright (C) 2013 Association of Universities for Research in Astronomy
15 #                    (AURA)
16 #
17 # Redistribution and use in source and binary forms, with or without
18 # modification, are permitted provided that the following conditions are met:
19 #
20 #     1. Redistributions of source code must retain the above copyright
21 #        notice, this list of conditions and the following disclaimer.
22 #
23 #     2. Redistributions in binary form must reproduce the above
24 #        copyright notice, this list of conditions and the following
25 #        disclaimer in the documentation and/or other materials provided
26 #        with the distribution.
27 #
28 #     3. The name of AURA and its representatives may not be used to
29 #        endorse or promote products derived from this software without
30 #        specific prior written permission.
31 #
32 # THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED
33 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 # DISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT,
36 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
37 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
38 # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
40 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
41 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
42 # DAMAGE.
43
44 import os
45
46
47 TRUE_VALUES = ('true', '1', 'yes')
48
49
50 def get_boolean_option(option_dict, option_name, env_name):
51     return ((option_name in option_dict
52              and option_dict[option_name][1].lower() in TRUE_VALUES) or
53             str(os.getenv(env_name)).lower() in TRUE_VALUES)