linkchecker/Makefile

198 lines
6.2 KiB
Makefile
Raw Normal View History

# This Makefile is only used by developers.
2011-04-22 06:39:45 +00:00
PYVER:=2.7
PYTHON?=python$(PYVER)
2009-08-19 18:41:26 +00:00
VERSION:=$(shell $(PYTHON) setup.py --version)
PLATFORM:=$(shell $(PYTHON) -c "from __future__ import print_function; from distutils.util import get_platform; print(get_platform())")
2013-01-06 17:10:13 +00:00
APPNAME:=$(shell $(PYTHON) setup.py --name)
2013-04-15 16:48:08 +00:00
AUTHOR:=$(shell $(PYTHON) setup.py --author)
MAINTAINER:=$(shell $(PYTHON) setup.py --maintainer)
2013-01-06 17:10:13 +00:00
LAPPNAME:=$(shell echo $(APPNAME)|tr "[A-Z]" "[a-z]")
ARCHIVE_SOURCE_EXT:=gz
ARCHIVE_SOURCE:=$(APPNAME)-$(VERSION).tar.$(ARCHIVE_SOURCE_EXT)
GITUSER:=linkchecker
2013-01-06 17:10:13 +00:00
GITREPO:=$(LAPPNAME)
2013-02-20 19:50:22 +00:00
HOMEPAGE:=$(HOME)/public_html/$(LAPPNAME)-webpage.git
2013-04-15 16:48:08 +00:00
WEB_META:=doc/web/app.yaml
2013-01-06 17:10:13 +00:00
DEBUILDDIR:=$(HOME)/projects/debian/official
DEBORIGFILE:=$(DEBUILDDIR)/$(LAPPNAME)_$(VERSION).orig.tar.$(ARCHIVE_SOURCE_EXT)
2013-01-06 21:55:51 +00:00
DEBPACKAGEDIR:=$(DEBUILDDIR)/$(APPNAME)-$(VERSION)
FILESCHECK_URL:=http://localhost/~calvin/
2012-12-18 22:05:45 +00:00
SRCDIR:=${HOME}/src
2016-01-23 12:28:15 +00:00
PY_FILES_DIRS:=linkcheck tests *.py linkchecker cgi-bin config doc/examples scripts
MYPY_FILES_DIRS:=linkcheck/HtmlParser linkcheck/checker \
linkcheck/cache linkcheck/configuration linkcheck/director \
linkcheck/htmlutil linkcheck/logger linkcheck/network \
linkcheck/bookmarks linkcheck/plugins linkcheck/parser \
$(filter-out %2.py,$(wildcard linkcheck/*.py)) \
cgi-bin/lc.wsgi \
linkchecker \
*.py
2012-09-26 14:54:54 +00:00
TESTS ?= tests
# set test options, eg. to "--verbose"
TESTOPTS=
2009-03-04 21:22:43 +00:00
PAGER ?= less
# options to run the pep8 utility
2010-03-13 07:47:12 +00:00
PEP8OPTS:=--repeat --ignore=E211,E501,E225,E301,E302,E241 \
--exclude="robotparser2.py"
2011-04-25 13:20:48 +00:00
PY2APPOPTS ?=
2011-05-28 06:22:54 +00:00
ifeq ($(shell uname),Darwin)
CHMODMINUSMINUS:=
2011-05-28 06:22:54 +00:00
else
CHMODMINUSMINUS:=--
2011-05-28 06:22:54 +00:00
endif
2012-09-26 14:54:54 +00:00
# Pytest options:
2013-04-15 16:47:54 +00:00
# - use multiple processes
2012-09-26 14:54:54 +00:00
# - write test results in file
2013-04-15 16:47:54 +00:00
PYTESTOPTS:=-n 4 --resultlog=testresults.txt
2012-06-25 18:08:53 +00:00
all:
2011-01-09 15:51:15 +00:00
@echo "Read the file doc/install.txt to see how to build and install this package."
clean:
-$(PYTHON) setup.py clean --all
2012-12-18 22:05:45 +00:00
rm -f $(LAPPNAME)-out.* *-stamp*
find . -name '*.py[co]' -exec rm -f {} \;
2016-01-23 12:28:15 +00:00
find . -name '*.bak' -exec rm -f {} \;
2014-09-12 19:59:07 +00:00
find . -depth -name '__pycache__' -exec rm -rf {} \;
2013-01-06 17:10:13 +00:00
distclean: clean
rm -rf build dist $(APPNAME).egg-info
rm -f _$(APPNAME)_configdata.py MANIFEST Packages.gz
# clean aborted dist builds and -out files
2012-12-18 22:05:45 +00:00
rm -f $(LAPPNAME)-out* $(LAPPNAME).prof
2012-10-14 09:53:07 +00:00
rm -f alexa*.log testresults.txt
rm -rf $(APPNAME)-$(VERSION)
rm -rf coverage dist-stamp python-build-stamp*
MANIFEST: MANIFEST.in setup.py
$(PYTHON) setup.py sdist --manifest-only
locale:
2014-09-08 16:25:03 +00:00
$(MAKE) -C po
# to build in the current directory
2012-04-22 16:04:06 +00:00
localbuild: MANIFEST locale
$(PYTHON) setup.py build
2013-01-06 17:10:13 +00:00
release: distclean releasecheck filescheck
$(MAKE) dist sign register upload homepage tag changelog deb
2013-01-06 17:10:13 +00:00
tag:
git tag upstream/$(VERSION)
git push --tags origin upstream/$(VERSION)
upload:
2014-04-23 20:05:31 +00:00
twine upload dist/$(ARCHIVE_SOURCE) dist/$(ARCHIVE_SOURCE).asc
homepage:
2013-04-15 16:48:08 +00:00
# update metadata
@echo "version: \"$(VERSION)\"" > $(WEB_META)
@echo "name: \"$(APPNAME)\"" >> $(WEB_META)
@echo "lname: \"$(LAPPNAME)\"" >> $(WEB_META)
@echo "maintainer: \"$(MAINTAINER)\"" >> $(WEB_META)
@echo "author: \"$(AUTHOR)\"" >> $(WEB_META)
2014-03-04 21:06:04 +00:00
git add $(WEBMETA)
-git commit -m "Updated webpage meta info"
2013-01-06 17:10:13 +00:00
# update documentation and man pages
2011-05-30 16:34:43 +00:00
$(MAKE) -C doc man
2013-04-15 16:48:08 +00:00
$(MAKE) -C doc/web release
register:
@echo "Register at Python Package Index..."
$(PYTHON) setup.py register
@echo "done."
2013-01-06 17:10:13 +00:00
deb:
# build a debian package
[ -f $(DEBORIGFILE) ] || cp dist/$(ARCHIVE_SOURCE) $(DEBORIGFILE)
sed -i -e 's/VERSION_$(LAPPNAME):=.*/VERSION_$(LAPPNAME):=$(VERSION)/' $(DEBUILDDIR)/$(LAPPNAME).mak
[ -d $(DEBPACKAGEDIR) ] || (cd $(DEBUILDDIR); \
patool extract $(DEBORIGFILE); \
cd $(CURDIR); \
git checkout debian; \
cp -r debian $(DEBPACKAGEDIR); \
rm -f $(DEBPACKAGEDIR)/debian/.gitignore; \
2013-01-06 17:10:13 +00:00
git checkout master)
$(MAKE) -C $(DEBUILDDIR) $(LAPPNAME)_clean $(LAPPNAME)
chmod:
-chmod -R a+rX,u+w,go-w $(CHMODMINUSMINUS) *
find . -type d -exec chmod 755 {} \;
dist: locale MANIFEST chmod
rm -f dist/$(ARCHIVE_SOURCE)
$(PYTHON) setup.py sdist --formats=tar
gzip --best dist/$(APPNAME)-$(VERSION).tar
# The check programs used here are mostly local scripts on my private system.
# So for other developers there is no need to execute this target.
check:
check-copyright
check-pofiles -v
py-tabdaddy $(MYPY_FILES_DIRS)
2010-03-05 11:50:27 +00:00
py-unittest2-compat tests/
2012-10-15 16:19:08 +00:00
$(MAKE) -C doc check
2011-02-14 19:28:49 +00:00
$(MAKE) doccheck
$(MAKE) pyflakes
2011-02-14 19:28:49 +00:00
doccheck:
py-check-docstrings --force $(MYPY_FILES_DIRS)
2011-02-14 19:28:49 +00:00
2012-05-12 12:44:18 +00:00
filescheck: localbuild
2012-09-18 07:16:34 +00:00
for out in text html gml sql csv xml gxml dot sitemap; do \
2012-12-18 22:05:45 +00:00
./$(LAPPNAME) -o$$out -F$$out --complete -r1 -C $(FILESCHECK_URL) || exit 1; \
done
2009-02-24 14:18:42 +00:00
2010-03-07 10:59:18 +00:00
update-copyright:
update-copyright --holder="Bastian Kleineidam" $(PY_FILES_DIRS)
2010-03-07 10:59:18 +00:00
2014-03-11 19:23:41 +00:00
releasecheck: check
@if egrep -i "xx\.|xxxx|\.xx" doc/changelog.txt > /dev/null; then \
echo "Could not release: edit doc/changelog.txt release date"; false; \
fi
2012-01-11 20:08:45 +00:00
$(PYTHON) setup.py check --restructuredtext
2013-01-06 17:10:13 +00:00
sign:
for f in $(shell find dist -name *.$(ARCHIVE_SOURCE_EXT) -o -name *.exe -o -name *.zip -o -name *.dmg); do \
[ -f $${f}.asc ] || gpg --detach-sign --armor $$f; \
done
test: localbuild
env LANG=en_US.utf-8 $(PYTHON) -m pytest $(PYTESTOPTS) $(TESTOPTS) $(TESTS)
pyflakes:
pyflakes $(PY_FILES_DIRS) 2>&1 | \
grep -v "local variable 'dummy' is assigned to but never used" | \
2016-01-23 12:28:15 +00:00
grep -v -E "'(biplist|setuptools|win32com|find_executable|parse_sitemap|parse_sitemapindex|parse_bookmark_data|parse_bookmark_file|wsgiref|pyftpdlib|linkchecker_rc)' imported but unused" | \
grep -v "undefined name '_'" | \
grep -v "undefined name '_n'" | cat
pep8:
pep8 $(PEP8OPTS) $(PY_FILES_DIRS)
2012-12-18 22:05:45 +00:00
# Compare custom Python files with the originals
diff:
@for f in gzip robotparser; do \
echo "Comparing $${f}.py"; \
2012-12-18 22:05:45 +00:00
diff -u linkcheck/$${f}2.py $(SRCDIR)/cpython.hg/Lib/$${f}.py | $(PAGER); \
done
2012-12-18 22:05:45 +00:00
@diff -u linkcheck/better_exchook.py $(SRCDIR)/py_better_exchook.git/better_exchook.py
changelog:
2012-12-18 22:05:45 +00:00
github-changelog $(DRYRUN) $(GITUSER) $(GITREPO) doc/changelog.txt
2011-04-26 14:14:34 +00:00
count:
2016-01-23 12:28:15 +00:00
@sloccount linkchecker linkcheck tests
2011-05-22 15:39:56 +00:00
# run eclipse ide
ide:
2011-12-17 18:13:32 +00:00
eclipse -data $(CURDIR)/..
2016-01-23 12:28:15 +00:00
.PHONY: test changelog count pyflakes ide login upload all clean distclean
2013-01-06 17:10:13 +00:00
.PHONY: pep8 cleandeb locale localbuild deb diff dnsdiff sign
.PHONY: filescheck update-copyright releasecheck check register announce
.PHONY: chmod dist release homepage