summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/env.py.in
blob: d76e17f5739894d883edd3553ccc986a84ebc387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

from __future__ import print_function

from plano import *

def _export(name, value):
    globals()[name] = value

    if value is not None:
        ENV[name] = value

def _export_module(name, path):
    _export(name, None)
    
    if exists(path):
        _export(name, path)

# Variables substituted by cmake

_export("BUILD_DIR", normalize_path("@CMAKE_BINARY_DIR@"))
_export("SOURCE_DIR", normalize_path("@CMAKE_SOURCE_DIR@"))
_export("SASLPASSWD2", normalize_path("@SASLPASSWD2_EXECUTABLE@"))
_export("PYTHON", normalize_path("@PYTHON_EXECUTABLE@"))
_export("VALGRIND", None)

if "@ENABLE_VALGRIND@" == "ON":
    _export("VALGRIND", normalize_path("@VALGRIND_EXECUTABLE@"))

# Python path

_python_path = [
    join(BUILD_DIR, "src", "tests"),
    join(BUILD_DIR, "bindings", "qpid", "python"),
    join(BUILD_DIR, "management", "python", "lib"),
]

if "PYTHONPATH" in ENV:
    _python_path.extend(ENV["PYTHONPATH"].split(PATH_VAR_SEP))

ENV["PYTHONPATH"] = PATH_VAR_SEP.join(_python_path)

# Path

_path = [
    join(BUILD_DIR, "src"),
    join(BUILD_DIR, "src", "RelWithDebInfo"),
    join(BUILD_DIR, "src", "tests"),
    join(BUILD_DIR, "src", "tests", "RelWithDebInfo"),
    join(BUILD_DIR, "management", "python", "bin"),
]

if "PATH" in ENV:
    _path.extend(ENV["PATH"].split(PATH_VAR_SEP))

ENV["PATH"] = PATH_VAR_SEP.join(_path)

# Modules

_export_module("HA_LIB", join(BUILD_DIR, "src", "ha.so"))
_export_module("XML_LIB", join(BUILD_DIR, "src", "xml.so"))
_export_module("AMQP_LIB", join(BUILD_DIR, "src", "amqp.so"))
_export_module("TEST_STORE_LIB", join(BUILD_DIR, "src", "tests", "test_store.so"))
_export_module("STORE_LIB", join(BUILD_DIR, "src", "linearstore.so"))

if STORE_LIB is None:
    _export_module("STORE_LIB", join(BUILD_DIR, "src", "legacystore.so"))

# Summarize

print("PWD:          {}".format(current_dir()))
print("SOURCE_DIR:   {}".format(SOURCE_DIR))
print("BUILD_DIR:    {}".format(BUILD_DIR))

print("PATH:")

for item in _path:
    print("  {}".format(item))

print("PYTHONPATH:")

for item in _python_path:
    print("  {}".format(item))