-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMakefile
More file actions
140 lines (120 loc) · 4.42 KB
/
Makefile
File metadata and controls
140 lines (120 loc) · 4.42 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Variables
PKG_NAME = pyats.contrib
BUILD_DIR = $(shell pwd)/__build__
DIST_DIR = $(BUILD_DIR)/dist
PYTHON = python3
PROD_USER = pyadm@pyats-ci
STAGING_PKGS = /auto/pyats/staging/packages
STAGING_EXT_PKGS = /auto/pyats/staging/packages
# xlrd==1.2 because support for '.xlsx' files was dropped in later versions
DEPENDENCIES = requests requests-toolbelt xlrd==1.2 xlwt xlsxwriter
.PHONY: check help clean test package develop undevelop all \
install_build_deps uninstall_build_deps distribute_staging\
distribute_staging_external
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_DIR))"
@echo " test run all unit tests"
@echo " help display this help"
@echo " develop set all package to development mode"
@echo " undevelop unset the above development mode"
@echo " install_build_deps install build dependencies"
@echo " uninstall_build_deps remove build dependencies"
@echo " distribute_staging Distribute the package to staging area"
@echo " distribute_staging_external Distribute the package to external staging area"
@echo ""
install_build_deps:
@pip install --upgrade pip setuptools wheel
uninstall_build_deps:
@echo "nothing to do"
clean:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Removing make directory: $(BUILD_DIR)"
@rm -rf $(BUILD_DIR)
@$(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
@find . -type d -name "build" | xargs rm -vrf
@echo "Done."
@echo ""
develop:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Setting up development environment"
@pip uninstall -y pyats.contrib || true
@pip install $(DEPENDENCIES)
@$(PYTHON) setup.py develop --no-deps -q
@echo ""
@echo "Done."
@echo ""
undevelop:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Removing development environment"
@$(PYTHON) setup.py develop -q --no-deps --uninstall
@echo ""
@echo "Done."
@echo ""
all: package
@echo ""
@echo "Done."
@echo ""
package:
@echo ""
@$(PYTHON) setup.py bdist_wheel --dist-dir=$(DIST_DIR)
@$(PYTHON) setup.py sdist --dist-dir=$(DIST_DIR)
@echo "Done."
@echo ""
check:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Checking setup.py consistency..."
@echo ""
@$(PYTHON) setup.py check
@echo "Done."
@echo ""
test:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Running unit tests..."
@echo ""
@$(PYTHON) -m unittest discover src
@echo "Done."
@echo ""
distribute_staging:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Copying all distributable to $(STAGING_PKGS)"
@test -d $(DIST_DIR) || { echo "Nothing to distribute! Exiting..."; exit 1; }
@ssh -q $(PROD_USER) 'test -e $(STAGING_PKGS)/$(PKG_NAME) || mkdir $(STAGING_PKGS)/$(PKG_NAME)'
@scp $(DIST_DIR)/* $(PROD_USER):$(STAGING_PKGS)/$(PKG_NAME)/
@echo ""
@echo "Done."
@echo ""
distribute_staging_external:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Copying all distributable to $(STAGING_EXT_PKGS)"
@test -d $(DIST_DIR) || { echo "Nothing to distribute! Exiting..."; exit 1; }
@ssh -q $(PROD_USER) 'test -e $(STAGING_EXT_PKGS)/$(PKG_NAME) || mkdir $(STAGING_EXT_PKGS)/$(PKG_NAME)'
@scp $(DIST_DIR)/* $(PROD_USER):$(STAGING_EXT_PKGS)/$(PKG_NAME)/
@echo ""
@echo "Done."
@echo ""
changelogs:
@echo ""
@echo "--------------------------------------------------------------------"
@echo "Generating changelog file"
@echo ""
@$(PYTHON) -c "from ciscodistutils.make_changelog import main; main('./docs/changelog/undistributed', './docs/changelog/undistributed.rst')"
@echo "pyats.contrib changelog created..."
@echo ""
@echo "Done."
@echo ""