linkchecker/Makefile

282 lines
7.9 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)
APPNAME:=LinkChecker
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()")
FILESCHECK_URL:=http://localhost/~calvin/
PYTHONSRC:=${HOME}/src/cpython-hg/Lib
2011-04-22 06:39:45 +00:00
#PYTHONSRC:=/usr/lib/$(PYTHON)
SF_FILEPATH=/home/frs/project/l/li/linkchecker
2012-06-19 22:29:46 +00:00
PY_FILES_DIRS:=linkcheck tests *.py linkchecker linkchecker-nagios linkchecker-gui cgi-bin config doc
TESTS ?= tests/
# set test options, eg. to "--nologcapture"
TESTOPTS=
2009-03-04 21:22:43 +00:00
PAGER ?= less
# build dir for debian package
BUILDDIR:=$(HOME)/projects/debian/official
2010-11-28 18:26:50 +00:00
DEB_ORIG_TARGET:=$(BUILDDIR)/linkchecker_$(VERSION).orig.tar.bz2
# 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)
2011-12-17 19:39:51 +00:00
NOSETESTS:=/usr/local/share/python/nosetests
CHMODMINUSMINUS:=
2011-05-28 06:22:54 +00:00
else
2011-12-17 19:39:51 +00:00
NOSETESTS:=$(shell which nosetests)
CHMODMINUSMINUS:=--
2011-05-28 06:22:54 +00:00
endif
2012-06-25 18:08:53 +00:00
# Nose options:
# - do not show output of successful tests
# - be verbose
# - only run test_* methods
NOSEOPTS:=--logging-clear-handlers -v -m '^test_.*'
.PHONY: all
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."
.PHONY: clean
clean:
-$(PYTHON) setup.py clean --all
2009-02-24 14:18:42 +00:00
rm -f linkchecker-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 {} \;
.PHONY: distclean
distclean: clean cleandeb
rm -rf build dist $(APPNAME).egg-info
rm -f _$(APPNAME)_configdata.py MANIFEST Packages.gz
# clean aborted dist builds and -out files
rm -f linkchecker-out* linkchecker.prof
rm -rf $(APPNAME)-$(VERSION)
rm -rf coverage dist-stamp python-build-stamp*
.PHONY: cleandeb
cleandeb:
rm -rf debian/linkchecker debian/tmp
rm -f debian/*.debhelper debian/{files,substvars}
rm -f configure-stamp build-stamp
MANIFEST: MANIFEST.in setup.py
$(PYTHON) setup.py sdist --manifest-only
.PHONY: locale
locale:
2012-04-11 18:33:09 +00:00
$(MAKE) -C po mofiles
# to build in the current directory
.PHONY: localbuild
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
cp -f build/lib.$(PLATFORM)-$(PYVER)/linkcheck/HtmlParser/htmlsax*.so linkcheck/HtmlParser
cp -f build/lib.$(PLATFORM)-$(PYVER)/linkcheck/network/_network*.so linkcheck/network
.PHONY: deb_orig
deb_orig:
if [ ! -e $(DEB_ORIG_TARGET) ]; then \
$(MAKE) dist-stamp && \
cp dist/$(APPNAME)-$(VERSION).tar.bz2 $(DEB_ORIG_TARGET); \
fi
.PHONY: upload
upload: dist/README.md
rsync -avP -e ssh dist/* calvin,linkchecker@frs.sourceforge.net:$(SF_FILEPATH)/$(VERSION)/
2009-08-04 20:38:21 +00:00
.PHONY: login
login:
# login to SSH shell
ssh -t sf-linkchecker create
dist/README.md: doc/README-Download.md.tmpl doc/changelog.txt
# copying readme for sourceforge downloads
sed -e 's/{APPNAME}/$(APPNAME)/g' -e 's/{VERSION}/$(VERSION)/g' $< > $@
# append changelog
awk '/released/ {c++}; c==2 {exit}; {print " " $$0}' doc/changelog.txt >> $@
.PHONY: release
2012-05-12 12:44:18 +00:00
release: distclean releasecheck filescheck clean dist-stamp sign_distfiles upload
2011-05-06 18:37:58 +00:00
git tag v$(VERSION)
@echo "Updating $(APPNAME) Homepage..."
2011-05-30 16:34:43 +00:00
$(MAKE) -C doc man
sed -i -e "s/version = '.*'/version = '$(VERSION)'/" ~/public_html/linkchecker.sf.net/source/conf.py
2009-08-04 20:38:21 +00:00
$(MAKE) -C ~/public_html/linkchecker.sf.net update upload
@echo "Register at Python Package Index..."
$(PYTHON) setup.py register
2011-12-25 08:00:22 +00:00
freecode-submit < linkchecker.freecode
.PHONY: chmod
chmod:
-chmod -R a+rX,u+w,go-w $(CHMODMINUSMINUS) *
find . -type d -exec chmod 755 {} \;
.PHONY: dist
dist: locale MANIFEST chmod
2010-11-28 18:26:50 +00:00
$(PYTHON) setup.py sdist --formats=bztar
# no rpm buildable with bdist_rpm, presumable due to this bug:
# https://bugzilla.redhat.com/show_bug.cgi?id=236535
# too uninvolved to fix it
dist-stamp: changelog
$(MAKE) dist
touch $@
2012-05-23 20:49:18 +00:00
# Build OSX installer with py2app
2011-04-25 13:13:43 +00:00
.PHONY: app
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
.PHONY: rpm
rpm:
$(MAKE) -C doc/html
$(MAKE) -C linkcheck/HtmlParser
$(PYTHON) setup.py bdist_rpm
# 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.
.PHONY: check
check:
[ ! -d .svn ] || check-nosvneolstyle -v
check-copyright
check-pofiles -v
2009-02-25 01:18:43 +00:00
py-tabdaddy
2010-03-05 11:50:27 +00:00
py-unittest2-compat tests/
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 linkcheck/HtmlParser linkcheck/checker \
linkcheck/cache linkcheck/configuration linkcheck/director \
linkcheck/htmlutil linkcheck/logger linkcheck/network \
linkcheck/bookmarks \
2011-02-17 18:59:02 +00:00
linkcheck/gui/__init__.py \
linkcheck/gui/checker.py \
linkcheck/gui/contextmenu.py \
linkcheck/gui/debug.py \
linkcheck/gui/editor.py \
2011-04-26 13:06:43 +00:00
linkcheck/gui/editor_qsci.py \
linkcheck/gui/editor_qt.py \
2011-02-17 18:59:02 +00:00
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 \
2011-04-26 19:31:45 +00:00
linkcheck/gui/syntax.py \
2011-02-17 18:59:02 +00:00
linkcheck/gui/updater.py \
linkcheck/gui/urlmodel.py \
linkcheck/gui/urlsave.py \
linkcheck/__init__.py \
linkcheck/ansicolor.py \
linkcheck/clamav.py \
linkcheck/containers.py \
linkcheck/cookies.py \
linkcheck/decorators.py \
linkcheck/dummy.py \
linkcheck/fileutil.py \
linkcheck/ftpparse.py \
linkcheck/geoip.py \
linkcheck/httputil.py \
linkcheck/i18n.py \
linkcheck/lc_cgi.py \
linkcheck/lock.py \
linkcheck/log.py \
linkcheck/mem.py \
linkcheck/robotparser2.py \
linkcheck/socketutil.py \
linkcheck/strformat.py \
linkcheck/threader.py \
linkcheck/trace.py \
linkcheck/updater.py \
linkcheck/url.py \
linkcheck/winutil.py \
cgi-bin/lc.wsgi \
2011-12-25 08:02:04 +00:00
linkchecker \
linkchecker-gui \
2012-06-19 22:29:46 +00:00
linkchecker-nagios \
*.py
2011-02-14 19:28:49 +00:00
2012-06-20 20:44:08 +00:00
.PHONY: filescheck
2012-05-12 12:44:18 +00:00
filescheck: localbuild
for out in text html gml sql csv xml gxml dot; do \
./linkchecker -o$$out -F$$out --complete -r1 -C $(FILESCHECK_URL) || exit 1; \
done
2009-02-24 14:18:42 +00:00
2012-06-20 20:44:08 +00:00
.PHONY: update-copyright
2010-03-07 10:59:18 +00:00
update-copyright:
update-copyright --holder="Bastian Kleineidam"
.PHONY: releasecheck
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
2011-12-25 08:00:22 +00:00
@if ! grep "Version: $(VERSION)" linkchecker.freecode > /dev/null; then \
echo "Could not release: edit linkchecker.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
.PHONY: sign_distfiles
sign_distfiles:
2011-04-26 13:55:18 +00:00
for f in $(shell find dist -name *.bz2 -o -name *.exe -o -name *.zip -o -name *.dmg); do \
[ -f $${f}.asc ] || gpg --detach-sign --armor $$f; \
done
.PHONY: test
test: localbuild
2012-06-25 18:08:53 +00:00
$(PYTHON) $(NOSETESTS) $(NOSEOPTS) $(TESTOPTS) $(TESTS)
.PHONY: pyflakes
pyflakes:
pyflakes $(PY_FILES_DIRS) 2>&1 | \
grep -v "redefinition of unused 'linkcheck'" | \
grep -v "undefined name '_'" | \
grep -v "undefined name '_n'" | cat
.PHONY: pep8
pep8:
pep8 $(PEP8OPTS) $(PY_FILES_DIRS)
# Compare custom Python files with the original ones from subversion.
.PHONY: diff
diff:
@for f in gzip robotparser httplib; do \
echo "Comparing $${f}.py"; \
2010-11-21 09:42:58 +00:00
diff -u linkcheck/$${f}2.py $(PYTHONSRC)/$${f}.py | $(PAGER); \
done
# Compare dnspython files with the ones from upstream repository
.PHONY: dnsdiff
dnsdiff:
@(for d in dns tests; do \
diff -BurN --exclude=*.pyc third_party/dnspython/$$d $(DNSPYTHON)/$$d; \
done) | $(PAGER)
.PHONY: changelog
changelog:
sftrack_changelog linkchecker calvin@users.sourceforge.net doc/changelog.txt $(DRYRUN)
.PHONY: gui
gui:
$(MAKE) -C linkcheck/gui
2011-04-26 14:14:34 +00:00
.PHONY: count
count:
2012-06-19 22:29:46 +00:00
@sloccount linkchecker linkchecker-gui linkchecker-nagios linkcheck | grep "Total Physical Source Lines of Code"
2011-05-22 15:39:56 +00:00
# run eclipse ide
.PHONY: ide
ide:
2011-12-17 18:13:32 +00:00
eclipse -data $(CURDIR)/..