diff --git a/.gitignore b/.gitignore index 6f83e12..36dcc72 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ var/ .eggs/ .pytest_cache/ +# source dirs have to be explicitly added +src/ + # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. diff --git a/Makefile b/Makefile index 6d79625..9f68e6e 100644 --- a/Makefile +++ b/Makefile @@ -31,18 +31,22 @@ BUILD_LOG_DIR = "test_build_logs/" BUILD_LOG_FILE := $(shell date +"$(BUILD_LOG_DIR)%Y%m%dt%H%M%S%N.log") -build/.install.make_marker: setup.py build/envs.txt - $(PYTHON36) -m pip install --upgrade --quiet \ - pip setuptools wheel twine \ - flake8 mypy typing-extensions \ - rst2html5 \ - pytest pytest-cov \ - ipython pudb \ - pathlib2 click; +build/.install.make_marker: setup.py build/envs.txt requirements*.txt + $(PYTHON37) -m pip install --upgrade --quiet $$(cat requirements.txt); + $(PYTHON36) -m pip install --upgrade --quiet $$(cat requirements.txt); + $(PYTHON27) -m pip install --upgrade --quiet $$(cat requirements.txt); - $(PYTHON37) -m pip install --upgrade --quiet pip setuptools wheel; - $(PYTHON36) -m pip install --upgrade --quiet pip setuptools wheel; - $(PYTHON27) -m pip install --upgrade --quiet pip setuptools wheel; + $(PYTHON37) -m pip install --upgrade \ + $$(cat requirements-test.txt) \ + $$(cat requirements-dev.txt); + + # NOTE (mb 2018-08-23): The linter has an issue running with + # python 3.7 because some code in pycodestyle=2.3.1 + # but we have to wait for a flake8 update because + # reasons... https://github.com/PyCQA/pycodestyle/issues/728 + @mkdir -p lib/ + $(PYTHON37) -m pip install --src lib/ \ + -e "git+https://gitlab.com/pycqa/flake8@master#egg=flake8"; @mkdir -p build/ @touch build/.install.make_marker @@ -54,28 +58,22 @@ clean: rm -f build/.install.make_marker -# NOTE (mb 2018-08-23): The linter has an issue running with -# python 3.7 because some code in pycodestyle=2.3.1 -# but we have to wait for a flake8 update because -# reasons... https://github.com/PyCQA/pycodestyle/issues/728 - - lint: build/.install.make_marker @echo -n "lint.." - @$(PYTHON36) -m flake8 src/pycalver/ + @$(PYENV37)/bin/flake8 src/pycalver/ @echo "ok" mypy: build/.install.make_marker @echo -n "mypy.." - @MYPYPATH=stubs/ $(PYTHON36) -m mypy \ + @MYPYPATH=stubs/ $(PYTHON37) -m mypy \ src/pycalver/ @echo "ok" test: build/.install.make_marker @PYTHONPATH=src/:$$PYTHONPATH \ - $(PYTHON36) -m pytest \ + $(PYTHON37) -m pytest \ --cov-report html \ --cov=pycalver \ test/ @@ -83,7 +81,7 @@ test: build/.install.make_marker devtest: build/.install.make_marker PYTHONPATH=src/:$$PYTHONPATH \ - $(PYTHON36) -m pytest -v \ + $(PYTHON37) -m pytest -v \ --cov-report term \ --cov=pycalver \ --capture=no \ @@ -107,7 +105,7 @@ build/README.html: build/.install.make_marker README.rst CHANGELOG.rst @cat README.rst > build/.full_readme.rst @echo "\n" >> build/.full_readme.rst @cat CHANGELOG.rst >> build/.full_readme.rst - @$(PYENV36)/bin/rst2html5 --strict \ + @$(PYENV37)/bin/rst2html5 --strict \ build/.full_readme.rst > build/README.html.tmp @mv build/README.html.tmp build/README.html @echo "updated build/README.html" @@ -123,17 +121,18 @@ build/.src_files.txt: setup.py build/envs.txt src/pycalver/*.py rm_site_packages: - rm -rf $(PYENV36)/lib/python3.6/site-packages/pycalver/ - rm -rf $(PYENV36)/lib/python3.6/site-packages/pycalver*.dist-info/ - rm -rf $(PYENV36)/lib/python3.6/site-packages/pycalver*.egg-info/ - rm -f $(PYENV36)/lib/python3.6/site-packages/pycalver*.egg + # whackamole + rm -rf $(PYENV37)/lib/python3.6/site-packages/pycalver/ + rm -rf $(PYENV37)/lib/python3.6/site-packages/pycalver*.dist-info/ + rm -rf $(PYENV37)/lib/python3.6/site-packages/pycalver*.egg-info/ + rm -f $(PYENV37)/lib/python3.6/site-packages/pycalver*.egg build/.local_install.make_marker: build/.src_files.txt rm_site_packages @echo "installing pycalver.." - @$(PYTHON36) setup.py install --no-compile --verbose + @$(PYTHON37) setup.py install --no-compile --verbose @mkdir -p build/ - @$(PYTHON36) -c "import pycalver" + @$(PYTHON37) -c "import pycalver" @echo "install completed for pycalver" @touch build/.local_install.make_marker @@ -142,13 +141,13 @@ build: build/.local_install.make_marker @mkdir -p $(BUILD_LOG_DIR) @echo "writing full build log to $(BUILD_LOG_FILE)" @echo "building pycalver.." - @$(PYTHON36) setup.py bdist_wheel --python-tag=py2.py3 >> $(BUILD_LOG_FILE) + @$(PYTHON37) setup.py bdist_wheel --python-tag=py2.py3 >> $(BUILD_LOG_FILE) @echo "build completed for pycalver" upload: build/.install.make_marker build/README.html - $(PYTHON36) setup.py bdist_wheel --python-tag=py2.py3 - $(PYENV36)/bin/twine upload $(BDIST_WHEEL_PYCALVER) + $(PYTHON37) setup.py bdist_wheel --python-tag=py2.py3 + $(PYENV37)/bin/twine upload $(BDIST_WHEEL_PYCALVER) setup_conda_envs: build/.setup_conda_envs.make_marker @@ -156,4 +155,4 @@ setup_conda_envs: build/.setup_conda_envs.make_marker install: build/.install.make_marker run_main: - PYTHONPATH=src/:$$PYTHONPATH $(PYTHON36) -m pycalver --help + PYTHONPATH=src/:$$PYTHONPATH $(PYTHON37) -m pycalver --help diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..822131f --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,5 @@ +wheel +pip +twine +ipython +pudb diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..ca32388 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,7 @@ +flake8 +mypy +typing-extensions +rst2html5 +pytest +pytest-cov +codecov diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..adcf504 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +setuptools +pathlib2 +typing +click