-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
89 lines (71 loc) · 2.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
# Makefile for the Python project
#
# It supports creating distribution files, and deploying them to Pypi and Pypitest or installing them locally
#
# A Python interpreter is required, and it should be accessible from the command line.
# Sets the variables.
# Sets the Python executable.
# It will be the executable for the interpreter set up for the command line.
PYTHON = python3
# Sets the distribution folder.
# It will be the 'dist' folder.
DISTDIR = dist
# Sets the .egg file path.
# The file will be located at the project's root.
EGGDIR = dice-notation.egg-info
# Sets the tox folder path.
# It will be the '.tox' folder.
TOXDIR = .tox
# Sets the docs output folder path.
# It will be in the 'docs' folder.
DOCBUILDDIR = docs\\build
# User-friendly check for sphinx-build
ifeq ($(shell which $(PYTHON) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(PYTHON)' command was not found. Make sure you have a version of the python interpreter installed, then add the directory where it was installed to the PATH.)
endif
.PHONY: help clean
# Help option
# Shows the allowed commands to be received as parameters
help:
@echo "Please use 'make <target>' where <target> is one of"
@echo " clean to remove the distribution folders"
@echo " build to build the distribution"
@echo " install to install the project"
@echo " requirements to install the project requirements"
@echo " register to register on pypi"
@echo " register-test to register on testpypi"
@echo " deploy to upload to pypi"
@echo " deploy-test to upload to testpypi"
@echo " test to run tests"
# Clean option
# Removes the distribution folder and the .egg file
clean:
rm -r -f $(DISTDIR)
rm -r -f $(EGGDIR)
rm -r -f $(TOXDIR)
rm -r -f $(DOCBUILDDIR)
# Distribution.
build:
$(PYTHON) setup.py sdist
# Install in local libraries repository
install:
$(PYTHON) setup.py install
# Install the project requirements
requirements:
pip install --upgrade -r requirements.txt
# Pypi registration.
register:
$(PYTHON) setup.py register -r pypi
# Pypitest registration.
register-test:
$(PYTHON) setup.py register -r testpypi
# Pypi deployment.
deploy:
$(PYTHON) setup.py sdist
twine upload dist/*
# Pypitest deployment.
deploy-test:
$(PYTHON) setup.py sdist upload -r testpypi
# Tests suite.
test:
tox