加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 4.39 KB
一键复制 编辑 原始数据 按行查看 历史
ChrisRees 提交于 2018-03-16 15:33 . Allow SAS migration (#575)
ROOT ?= ${PWD}
ENV_DIR := $(shell pwd)/_env
PYTHON_BIN := $(shell which python)
SETUPTOOLS_VERSION=30
DEB_COMPONENT := clearwater-etcd
DEB_MAJOR_VERSION ?= 1.0${DEB_VERSION_QUALIFIER}
DEB_NAMES := clearwater-etcd clearwater-cluster-manager clearwater-queue-manager clearwater-config-manager clearwater-management
DEB_ARCH := all
# The build has been seen to fail on Mac OSX when trying to build on i386. Enable this to build for x86_64 only
X86_64_ONLY=0
.DEFAULT_GOAL = deb
TEST_PYTHON_PATH = src:common
CLEAN_SRC_DIR = src/
FLAKE8_INCLUDE_DIR = src/
FLAKE8_EXCLUDE_DIR = src/clearwater_etcd_plugins/
BANDIT_EXCLUDE_LIST = src/metaswitch/clearwater/queue_manager/test/,src/metaswitch/clearwater/plugin_tests/,src/metaswitch/clearwater/etcd_tests/,src/metaswitch/clearwater/etcd_shared/test,src/metaswitch/clearwater/config_manager/test/,src/metaswitch/clearwater/cluster_manager/test/,common,_env,.wheelhouse,debian,build_clustermgr,build_configmgr,build_shared
include build-infra/cw-deb.mk
include build-infra/python.mk
# Macro to define the various etcd targets
#
# @param $1 Name of the etcd target (e.g. "queue-mgr")
#
# For the given components, calls into the python_component macro, and also
# ensures that this component depends on building the python-common wheel
define etcd_component
# Define the variables for this component that will be used by the
# python_component macro
$1_SETUP = $1_setup.py shared_setup.py
$1_REQUIREMENTS = $1-requirements.txt common/requirements.txt shared-requirements.txt
$1_TEST_REQUIREMENTS = common/requirements-test.txt requirements-test.txt
$1_TEST_SETUP = $1_setup.py
# We exclude alarm constants from the source file list because these are
# generated by the makefile and so may be newer (they're handled below)
$1_SOURCES = $(shell find src/metaswitch -type f -not -name "*.pyc" -not -name "alarm_constants.py") $(shell find common/metaswitch -type f -not -name "*.pyc")
$1_BUILD_DIRS = T
$1_WHEELS = clearwater_etcd_shared metaswitchcommon
# Call into the python_component macro in the common python.mk
$$(eval $$(call python_component,$1))
# Add a target that builds the python-common wheel into the correct wheelhouse
$${$1_WHEELHOUSE}/.$1_build_common_wheel: $(shell find common/metaswitch -type f -not -name "*.pyc") $${$1_WHEELHOUSE}/.clean-wheels
cd common && WHEELHOUSE=../$1_wheelhouse make build_common_wheel
touch $$@
# Add dependency to the install-wheels and wheelhouse-complete to ensure we've built
# python-common before we try to install it or consider the wheelhouse complete
${ENV_DIR}/.$1-install-wheels: $${$1_WHEELHOUSE}/.$1_build_common_wheel
$${$1_WHEELHOUSE}/.wheelhouse_complete: $${$1_WHEELHOUSE}/.$1_build_common_wheel
# Test definition
.PHONY: test_$1
test_$1: $1_setup.py env ${ENV_DIR}/.test-requirements
PYTHONPATH=src:common ${PYTHON} $1_setup.py test -v
# Add the test target to run_test
run_test: test_$1
# Add the alarm constants target
src/metaswitch/clearwater/$$(subst mgr,manager,$1)/alarm_constants.py: clearwater-$$(subst _,-,$$(subst mgr,manager,$1)).root/usr/share/clearwater/infrastructure/alarms/clearwater_$$(subst mgr,manager,$1)_alarms.json common/metaswitch/common/alarms_writer.py common/metaswitch/common/alarms_parser.py common/metaswitch/common/alarm_severities.py
python common/metaswitch/common/alarms_writer.py --json-file="clearwater-$$(subst _,-,$$(subst mgr,manager,$1)).root/usr/share/clearwater/infrastructure/alarms/clearwater_$$(subst mgr,manager,$1)_alarms.json" --constants-file=$$@
# Add a dependency to the build-wheels targets for the alarm constants
$${$1_WHEELHOUSE}/.build-wheels: src/metaswitch/clearwater/$$(subst mgr,manager,$1)/alarm_constants.py
endef
# Use the macro to define the queue-, config- and cluster-manager components
$(eval $(call etcd_component,queue_mgr))
$(eval $(call etcd_component,config_mgr))
$(eval $(call etcd_component,cluster_mgr))
# Create the plugins-test target
plugins_TEST_REQUIREMENTS = requirements-test.txt common/requirements-test.txt common/requirements.txt shared-requirements.txt
plugins_TEST_SETUP = plugins_setup.py
$(eval $(call python_test_component,plugins))
# Create the fv_test target. Exclude it from `test` and `coverage`, but add it
# to `full_test`
fv_TEST_REQUIREMENTS = fv-requirements.txt requirements-test.txt
fv_TEST_SETUP = fvtest_setup.py
$(eval $(call python_test_component,fv,EXCLUDE_TEST))
full_test: fv_test
.PHONY: deb
deb: wheelhouses deb-only
.PHONY: clean
clean: envclean pyclean
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化