diff --git a/Makefile b/Makefile index 8800620..827f4b8 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,25 @@ -# -# install cython in a virtualenv named cython -# workon cython -# ... -# +# Most targets are expected to be built inside a virtualenv, +# its building as well as restarting make in it is automated. -veosinfo/_veosinfo.so: veosinfo/_veosinfo.pyx - python setup.py build_ext -i --use-cython +ifeq ($(VIRTUAL_ENV),) -test: - PATHONPATH=. python test_veosinfo.py +# If virtual environment is not active, restart within virtual environment +SELF := $(MAKE) -f $(lastword $(MAKEFILE_LIST)) +MAKE := $(shell echo $$MAKE) -clean: - rm -f veosinfo/*.so veosinfo/_veosinfo.c veosinfo/*.pyc +in_venv: | venv + @echo "Virtual environment not active. Restarting within virtual environment..." + @echo "MAKECMDGOALS = $(MAKECMDGOALS)" + . venv/bin/activate && $(SELF) $(MAKEFLAGS) $(MAKECMDGOALS) -install: veosinfo/_veosinfo.so - python setup.py install +sdist rpm srpm upload: in_venv + +else + +veosinfo/_veosinfo.so: in_venv veosinfo/_veosinfo.pyx + python setup.py build_ext -i --use-cython +.PHONY: sdist upload sdist: python setup.py sdist --use-cython @@ -31,5 +35,20 @@ rpm: veosinfo/_veosinfo.so srpm: veosinfo/_veosinfo.so python setup.py bdist_rpm --source-only -.PHONY: test clean install sdist rpm +endif + +.PHONY: test clean install +test: + PYTHONPATH=. python test_veosinfo.py + +clean: + rm -f veosinfo/*.so veosinfo/_veosinfo.c veosinfo/*.pyc + +install: veosinfo/_veosinfo.so + python setup.py install +venv: + python3 -m venv venv && \ + . venv/bin/activate && \ + pip install -U pip && \ + pip install -r requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9a56527 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +cython +twine +wheel