linkchecker/Makefile

260 lines
8.1 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)
2011-04-25 12:40:10 +00:00
PLATFORM:=$(shell $(PYTHON) -c "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:=$(APPNAME)-$(VERSION).tar.xz
ARCHIVE_WIN32:=$(APPNAME)-$(VERSION).exe
GITUSER:=wummel
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.xz
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
2014-03-12 18:22:07 +00:00
PY_FILES_DIRS:=linkcheck tests *.py linkchecker linkchecker-gui 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 \
linkcheck/gui/__init__.py \
linkcheck/gui/checker.py \
linkcheck/gui/contextmenu.py \
linkcheck/gui/debug.py \
linkcheck/gui/editor.py \
linkcheck/gui/editor_qsci.py \
linkcheck/gui/editor_qt.py \
linkcheck/gui/lineedit.py \
linkcheck/gui/help.py \
linkcheck/gui/logger.py \
linkcheck/gui/options.py \
linkcheck/gui/properties.py \
linkcheck/gui/settings.py \
linkcheck/gui/statistics.py \
linkcheck/gui/syntax.py \
linkcheck/gui/updater.py \
linkcheck/gui/urlmodel.py \
linkcheck/gui/urlsave.py \
$(filter-out %2.py,$(wildcard linkcheck/*.py)) \
cgi-bin/lc.wsgi \
linkchecker \
linkchecker-gui \
*.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
# original dnspython repository module
DNSPYTHON:=$(HOME)/src/dnspython-git
# options to run the pep8 utility
2010-03-13 07:47:12 +00:00
PEP8OPTS:=--repeat --ignore=E211,E501,E225,E301,E302,E241 \
2011-10-19 11:44:48 +00:00
--exclude="gzip2.py,httplib2.py,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*
$(MAKE) -C po clean
2009-07-29 19:53:52 +00:00
$(MAKE) -C doc/html clean
$(MAKE) -C linkcheck/HtmlParser clean
rm -f linkcheck/network/_network*.so
find . -name '*.py[co]' -exec rm -f {} \;
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:
2012-04-11 18:33:09 +00:00
$(MAKE) -C po mofiles
# to build in the current directory
2012-04-22 16:04:06 +00:00
localbuild: MANIFEST locale
2011-04-26 12:44:18 +00:00
$(MAKE) -C doc/html
$(MAKE) -C linkcheck/HtmlParser
$(PYTHON) setup.py build
2012-10-26 16:05:00 +00:00
cp -f build/lib.$(PLATFORM)-$(PYVER)*/linkcheck/HtmlParser/htmlsax*.so linkcheck/HtmlParser
cp -f build/lib.$(PLATFORM)-$(PYVER)*/linkcheck/network/_network*.so linkcheck/network
2013-01-06 17:10:13 +00:00
release: distclean releasecheck filescheck
2013-04-11 16:29:23 +00:00
$(MAKE) dist sign upload homepage tag register changelog deb
2013-01-06 17:10:13 +00:00
tag:
git tag upstream/$(VERSION)
git push --tags origin upstream/$(VERSION)
2013-01-06 17:10:13 +00:00
upload:
2013-12-24 06:28:19 +00:00
cp dist/$(ARCHIVE_SOURCE) dist/$(ARCHIVE_WIN32) \
dist/$(ARCHIVE_SOURCE).asc dist/$(ARCHIVE_WIN32).asc \
$(HOMEPAGE)/dist
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."
@echo "Submitting to Freecode..."
2012-12-18 22:05:45 +00:00
freecode-submit < $(LAPPNAME).freecode
@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/$(APPNAME)-$(VERSION).tar.xz
$(PYTHON) setup.py sdist --formats=tar
2012-08-14 15:39:41 +00:00
xz dist/$(APPNAME)-$(VERSION).tar
2013-01-06 17:10:13 +00:00
[ ! -f ../$(ARCHIVE_WIN32) ] || cp ../$(ARCHIVE_WIN32) dist
2012-05-23 20:49:18 +00:00
# Build OSX installer with py2app
app: distclean localbuild chmod
2011-04-25 13:20:48 +00:00
$(PYTHON) setup.py py2app $(PY2APPOPTS)
2011-04-25 13:13:43 +00:00
2012-05-23 20:49:18 +00:00
# Build RPM installer with cx_Freeze
rpm:
$(MAKE) -C doc/html
$(MAKE) -C linkcheck/HtmlParser
$(PYTHON) setup.py bdist_rpm
# Build portable Linux app
binary: distclean localbuild chmod
LINKCHECKER_FREEZE=1 $(PYTHON) setup.py bdist
# 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
2013-01-06 17:10:13 +00:00
@if [ ! -f ../$(ARCHIVE_WIN32) ]; then \
echo "Missing WIN32 distribution archive at ../$(ARCHIVE_WIN32)"; \
false; \
fi
2012-12-18 22:05:45 +00:00
@if ! grep "Version: $(VERSION)" $(LAPPNAME).freecode > /dev/null; then \
echo "Could not release: edit $(LAPPNAME).freecode version"; false; \
2010-10-26 00:02:53 +00:00
fi
2012-01-11 20:08:45 +00:00
$(PYTHON) setup.py check --restructuredtext
2013-01-06 17:10:13 +00:00
sign:
2012-09-02 21:44:16 +00:00
for f in $(shell find dist -name *.xz -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" | \
grep -v -E "'(py2exe|py2app|PyQt4|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 httplib; 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
# Compare dnspython files with the ones from upstream repository
dnsdiff:
@(for d in dns tests; do \
diff -BurN --exclude=*.pyc third_party/dnspython/$$d $(DNSPYTHON)/$$d; \
done) | $(PAGER)
changelog:
2012-12-18 22:05:45 +00:00
github-changelog $(DRYRUN) $(GITUSER) $(GITREPO) doc/changelog.txt
gui:
$(MAKE) -C linkcheck/gui
2011-04-26 14:14:34 +00:00
count:
2014-03-04 20:51:19 +00:00
@sloccount linkchecker linkchecker-gui 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)/..
.PHONY: test changelog gui 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
2014-03-11 19:23:41 +00:00
.PHONY: chmod dist app rpm release homepage