default: go

#go2: test5

go2:
	rst2html4.py README.rst > README.html
	links2 -dump README.html

go: test5 test2 test3 test4 test6

pylint:
	./this-pylint --which-2 None --which-3 /usr/local/bin/pylint --to-pylint test-readline0-via-import readline0.py

test2: pylint
	find /usr/share/jpilot -print0 | python3 ./test-readline0-w-bytes > /dev/null

test3: pylint
	find /usr -print0 | ./head0 -n 1450 | ./this-tee 2 | python3 ./count -b -0 -d 10000 | ./this-tee 3 | xargs -0 stat > /dev/null

test4: pylint
	find /usr -print0 | ./head0 -n 10 | python3 ./count -b -0 | od -cx

test5: pylint
	python3 test-readline0-via-import
	# Jython is no longer supported.
	# /usr/local/jython-2.7/bin/jython test-readline0-via-import

test6: pylint
	find ${HOME} -type f -print0 | ./read-lines > /dev/null

install:
	./install-file --file readline0.py --directory /usr/local/lib/.
	./install-file --file python2x3.py --directory /usr/local/lib/.

deps:
	# python3 -m virtualenv ~/virtualenvs/readline0
	# source ~/virtualenvs/readline0/bin/activate
	python3 -m pip install twine

clean:
	rm -f *.pyc 2 3
	rm -rf __pycache__ .ropeproject
	rm -rf *.class
	rm -rf build
	rm -rf dist
	rm -rf readline0.egg-info
	rm -f README.html

publish: clean readline0.py
	python setup.py sdist
	twine upload dist/*

test-publish: clean readline0.py
	python3 setup.py sdist bdist_wheel
	twine check `ls dist/readline0-*-py3-none-any.whl | tail -1`
	twine upload --repository-url https://test.pypi.org/legacy/ dist/*