1- all : info clean flake8 test docs upload release
2- .PHONY : all docs upload info req
1+ all : info clean lint test docs dist upload release
2+ .PHONY : all docs upload info req dist
33
44PACKAGE_NAME := $(shell python setup.py --name)
55PACKAGE_VERSION := $(shell python setup.py --version)
66PYTHON_PATH := $(shell which python)
7- PLATFORM := $(shell uname -s | awk '{print tolower($0) }')
7+ PLATFORM := $(shell uname -s | awk '{print tolower($$ 0) }')
88DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST ) ) ) )
99PYTHON_VERSION := $(shell python3 -c "import sys; print('py% s% s' % sys.version_info[0:2] + ('-conda' if 'conda' in sys.version or 'Continuum' in sys.version else '') )")
10- PYENV_HOME := $(DIR ) /.tox/$(PYTHON_VERSION ) -$(PLATFORM ) /
11- ifneq (,$(findstring conda,$(PYTHON_VERSION ) ) )
12- CONDA: =1
13- endif
14-
10+ PREFIX =""
1511ifndef GIT_BRANCH
1612GIT_BRANCH =$(shell git branch | sed -n '/\* /s///p')
1713endif
1814
1915info :
2016 @echo " INFO: Building $( PACKAGE_NAME) :$( PACKAGE_VERSION) on $( GIT_BRANCH) branch"
21- @echo " INFO: Python $( PYTHON_VERSION) from $( PYENV_HOME ) [$( CONDA) ]"
17+ @echo " INFO: Python $( PYTHON_VERSION) from ' $( PREFIX ) ' [$( CONDA) ]"
2218
2319clean :
2420 @find . -name " *.pyc" -delete
25- @rm -rf .tox/ * - $( PLATFORM ) .tox/docs dist/* .tox/dist .tox/log docs/build/*
21+ @rm -rf .tox dist/* docs/build/*
2622
2723package :
2824 python setup.py sdist bdist_wheel build_sphinx
2925
3026req :
31- @$(PYENV_HOME ) /bin/ requires.io update-site -t ac3bbcca32ae03237a6aae2b02eb9411045489bb -r $(PACKAGE_NAME )
27+ @$(PREFIX ) requires.io update-site -t ac3bbcca32ae03237a6aae2b02eb9411045489bb -r $(PACKAGE_NAME )
3228
3329install : prepare
34- $(PYENV_HOME ) /bin/ pip install .
30+ $(PREFIX ) pip install .
3531
3632install-sdk :
3733 # https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/install-the-atlassian-sdk-on-a-linux-or-mac-system#InstalltheAtlassianSDKonaLinuxorMacsystem-Homebrew
3834 which atlas-run-standalone || brew tap atlassian/tap && brew install atlassian/tap/atlassian-plugin-sdk
3935
4036uninstall :
41- $(PYENV_HOME ) /bin/ pip uninstall -y $(PACKAGE_NAME )
37+ $(PREFIX ) pip uninstall -y $(PACKAGE_NAME )
4238
43- venv : $(PYENV_HOME ) /bin/activate
39+ dist :
40+ $(PREFIX ) python setup.py sdist bdist_wheel
4441
45- # virtual environment depends on requriements files
46- $(PYENV_HOME ) /bin/activate : requirements* .txt
47- @echo " INFO: (Re)creating virtual environment..."
48- ifdef CONDA
49- test -e $(PYENV_HOME)/bin/activate || conda create -y --prefix $(PYENV_HOME) pip
50- else
51- test -e $(PYENV_HOME)/bin/activate || virtualenv --python=$(PYTHON_PATH) --system-site-packages $(PYENV_HOME)
52- endif
53- $(PYENV_HOME)/bin/pip install -q -r requirements.txt -r requirements-opt.txt -r requirements-dev.txt
54- touch $(PYENV_HOME)/bin/activate
55-
56- prepare : venv
57- pyenv install -s 2.7.13
58- pyenv install -s 3.4.5
59- pyenv install -s 3.5.2
60- pyenv install -s 3.6.0
61- pyenv local 2.7.13 3.4.5 3.5.2 3.6.0
42+ prepare :
43+ @pyenv install -s 2.7.13
44+ @pyenv install -s 3.4.5
45+ @pyenv install -s 3.5.2
46+ @pyenv install -s 3.6.0
47+ @pyenv local 2.7.13 3.4.5 3.5.2 3.6.0
6248 @echo " INFO: === Prearing to run for package:$( PACKAGE_NAME) platform:$( PLATFORM) py:$( PYTHON_VERSION) dir:$( DIR) ==="
63- if [ -f ${HOME} /testspace/testspace ]; then ${HOME} /testspace/testspace config url ${TESTSPACE_TOKEN} @pycontribs.testspace.com/jira/tests ; fi ;
49+ # if [ -f ${HOME}/testspace/testspace ]; then ${HOME}/testspace/testspace config url ${TESTSPACE_TOKEN}@pycontribs.testspace.com/jira/tests ; fi;
6450
6551testspace :
6652 ${HOME} /testspace/testspace publish build/results.xml
6753
68- flake8 : venv
69- @echo " INFO: flake8 "
70- $(PYENV_HOME ) /bin/ python -m flake8
71- $( PYENV_HOME ) /bin/ python -m flake8 --install-hook 2> /dev/null || true
54+ lint :
55+ @echo " INFO: linting.... "
56+ $(PREFIX ) python -m flake8
57+ @ $( PREFIX ) python -m flake8 --install-hook 2> /dev/null || true
7258
73- test : prepare flake8
59+ test : prepare lint
7460 @echo " INFO: test"
75- $(PYENV_HOME ) /bin/python setup.py build test build_sphinx sdist bdist_wheel check --restructuredtext --strict
76-
77- test-cli :
78- $(PYENV_HOME ) /bin/ipython -c " import jira; j = jira.JIRA('https://pycontribs.atlassian.net'); j.server_info()" -i
61+ $(PREFIX ) python setup.py build test build_sphinx sdist bdist_wheel check --restructuredtext --strict
7962
8063test-all :
8164 @echo " INFO: test-all (extended/matrix tests)"
8265 # tox should not run inside virtualenv because it does create and use multiple virtualenvs
8366 pip install -q tox tox-pyenv
84- python -m tox --skip-missing-interpreters true
85-
67+ python -m tox
8668
8769docs :
8870 @echo " INFO: Building the docs"
89- $(PYENV_HOME ) /bin/ pip install sphinx
90- $(PYENV_HOME ) /bin/ python setup.py build_sphinx
71+ $(PREFIX ) pip install sphinx
72+ $(PREFIX ) python setup.py build_sphinx
9173 @mkdir -p docs/build/docset
9274 @mkdir -p docs/build/html/docset
9375# cannot put doc2dash into requirements.txt file because is using pinned requirements
@@ -114,11 +96,11 @@ endif
11496upload :
11597ifeq ($(GIT_BRANCH ) ,develop)
11698 @echo "INFO: Upload package to testpypi.python.org"
117- $(PYENV_HOME)/bin/ python setup.py check --restructuredtext --strict
118- $(PYENV_HOME)/bin/ python setup.py sdist bdist_wheel upload -r https://testpypi.python.org/pypi
99+ $(PREFIX) python setup.py check --restructuredtext --strict
100+ $(PREFIX) python setup.py sdist bdist_wheel upload -r https://testpypi.python.org/pypi
119101endif
120102ifeq ($(GIT_BRANCH ) ,master)
121103 @echo "INFO: Upload package to pypi.python.org"
122- $(PYENV_HOME)/bin/ python setup.py check --restructuredtext --strict
123- $(PYENV_HOME)/bin/ python setup.py sdist bdist_wheel upload
104+ $(PREFIX) python setup.py check --restructuredtext --strict
105+ $(PREFIX) python setup.py sdist bdist_wheel upload
124106endif
0 commit comments