forked from CiscoTestAutomation/genielibs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
115 lines (96 loc) · 3.31 KB
/
Makefile
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Variables
BUILD_ROOT = $(shell pwd)/__build__
OUTPUT_DIR = $(BUILD_ROOT)/dist
BUILD_CMD = python setup.py bdist_wheel --dist-dir=$(OUTPUT_DIR)
TESTCMD = ./tests/runAll --path tests/
# Development pkg requirements
DEPENDENCIES = restview psutil Sphinx wheel asynctest
DEPENDENCIES += setproctitle sphinxcontrib-napoleon sphinx-rtd-theme httplib2
DEPENDENCIES += pip-tools Cython requests
PKGS = conf ops robot sdk
.PHONY: help clean check develop undevelop test all $(PKGS)
help:
@echo "Please use 'make <target>' where <target> is one of"
@echo ""
@echo " --- common actions ---"
@echo ""
@echo " check check setup.py content"
@echo " clean remove the build directory ($(BUILD_ROOT))"
@echo " help display this help"
@echo " test run all unittests in an efficient manner"
@echo " develop set all package to development mode"
@echo " undevelop unset the above development mode"
@echo ""
@echo " --- build all targets ---"
@echo ""
@echo " all make all available pyATS packages"
@echo ""
@echo " --- build specific targets ---"
@echo ""
@echo " conf build genie.libs.conf package"
@echo " ops build genie.libs.ops package"
@echo " sdk build genie.libs.sdk package"
@echo " robot build genie.libs.robot package"
@echo ""
clean:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Removing make directory: $(BUILD_ROOT)"
@rm -rf $(BUILD_ROOT)
@$(foreach dir,$(PKGS),(cd pkgs/$(dir)-pkg && python setup.py clean) &&) :
@echo "Removing *.pyc *.c and __pycache__/ files"
@find . -type f -name "*.pyc" | xargs rm -vrf
@find . -type f -name "*.c" | xargs rm -vrf
@find . -type d -name "__pycache__" | xargs rm -vrf
@echo ""
@echo "Done."
@echo ""
develop:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Installing development dependencies"
@pip install $(DEPENDENCIES)
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Setting up development environment"
@$(foreach dir,$(PKGS),(cd pkgs/$(dir)-pkg && python setup.py develop --no-deps -q) &&) :
@echo ""
@echo "Done."
@echo ""
undevelop:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Removing development environment"
@$(foreach dir,$(PKGS),(cd pkgs/$(dir)-pkg && python setup.py develop -q --no-deps --uninstall) &&) :
@echo ""
@echo "Done."
@echo ""
all: $(PKGS)
@echo ""
@echo "Done."
@echo ""
$(PKGS):
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Building pyATS distributable: $@"
@echo ""
mkdir -p $(OUTPUT_DIR)/
cd pkgs/$@-pkg/; $(BUILD_CMD)
@echo "Completed building: $@"
@echo ""
test:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Running all unit tests..."
@echo ""
@$(TESTCMD)
@echo "Completed unit testing"
@echo ""
check:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Checking setup.py consistency..."
@echo ""
@$(foreach dir,$(PKGS),(cd pkgs/$(dir)-pkg && python setup.py check) &&) :
@echo "Done"
@echo ""