root/trunk/Makefile

Revision 802, 4.5 kB (checked in by schwa, 4 days ago)
Remove all but custom directory from debian directory in debdistclean.
  • Property svn:mime-type set to text/x-makefile
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 # Copyright (C) 2003-2008, Stefan Schwarzer
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7 #
8 # - Redistributions of source code must retain the above copyright
9 #   notice, this list of conditions and the following disclaimer.
10 #
11 # - Redistributions in binary form must reproduce the above copyright
12 #   notice, this list of conditions and the following disclaimer in the
13 #   documentation and/or other materials provided with the distribution.
14 #
15 # - Neither the name of the above author nor the names of the
16 #   contributors to the software may be used to endorse or promote
17 #   products derived from this software without specific prior written
18 #   permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 # $Id$
33
34
35 SHELL=/bin/sh
36 PROJECT_DIR=/home/schwa/sd/python/ftputil
37 VERSION=$(shell cat VERSION)
38 DEBIAN_DIR=${PROJECT_DIR}/debian
39 DOC_FILES=README.html ftputil.html ftputil_ru.html
40 TMP_LS_FILE=tmp_ls.out
41 STYLESHEET_PATH=default.css
42 WWW_DIR=${HOME}/www
43 SED=sed -i'' -r -e
44 RST2HTML=rst2html
45 PRODUCTION_FILES=ftp_error.py ftp_file.py ftp_path.py ftp_stat_cache.py \
46                                  ftp_stat.py ftputil.py ftputil_version.py __init__.py \
47                                  find_deprecated_code.py
48 # name test files; make sure _test_real_ftp.py is the last
49 TEST_FILES=$(shell ls _test_*.py | sed -e "s/_test_real_ftp.py//") \
50                    _test_real_ftp.py
51
52 .PHONY: dist extdist test pylint docs clean register patch debdistclean debdist
53 .SUFFIXES: .txt .html
54
55 test:
56         echo ${VERSION}
57         for file in $(TEST_FILES); \
58         do \
59                 python $$file ; \
60         done
61
62 pylint:
63         pylint --rcfile=pylintrc ${PRODUCTION_FILES} | less
64
65 ftputil_ru.html: ftputil_ru_utf8.txt
66         ${RST2HTML} --stylesheet-path=${STYLESHEET_PATH} --embed-stylesheet \
67                 --input-encoding=utf-8 $< $@
68
69 .txt.html:
70         ${RST2HTML} --stylesheet-path=${STYLESHEET_PATH} --embed-stylesheet $< $@
71
72 patch:
73         @echo "Patching files"
74         ${SED} "s/^__version__ = '.*'/__version__ = \'`cat VERSION`\'/" \
75                 ftputil_version.py
76         ${SED} "s/^:Version:   .*/:Version:   ${VERSION}/" ftputil.txt
77         ${SED} "s/^:Date:      .*/:Date:      `date +"%Y-%m-%d"`/" ftputil.txt
78         #TODO add rules for Russian translation
79         ${SED} "s/^Version: .*/Version: ${VERSION}/" PKG-INFO
80         ${SED} "s/(\/wiki\/Download\/ftputil-).*(\.tar\.gz)/\1${VERSION}\2/" \
81                 PKG-INFO
82
83 docs: ${DOC_FILES} README.txt ftputil.txt ftputil_ru_utf8.txt
84
85 manifestdiff: MANIFEST
86         @ls -1 | grep -v .pyc | grep -v ${TMP_LS_FILE} > ${TMP_LS_FILE}
87         -diff -u MANIFEST ${TMP_LS_FILE}
88         @rm ${TMP_LS_FILE}
89
90 dist: clean patch test pylint docs
91         python setup.py sdist
92
93 debdistclean:
94         cd ${DEBIAN_DIR} && rm -rf `ls -1 | grep -v "^custom$$"`
95
96 debdist: debdistclean
97         cp dist/ftputil-${VERSION}.tar.gz \
98            ${DEBIAN_DIR}/ftputil-${VERSION}.orig.tar.gz
99         tar -x -C ${DEBIAN_DIR} -zf ${DEBIAN_DIR}/ftputil-${VERSION}.orig.tar.gz
100         cd ${DEBIAN_DIR}/ftputil-${VERSION} && \
101           echo "\n" | dh_make --copyright bsd --single --cdbs && \
102           cd debian && \
103           rm *.ex *.EX dirs README.Debian
104         # copy custom files (control, rules, copyright, changelog, maybe others)
105         cp ${DEBIAN_DIR}/custom/* ${DEBIAN_DIR}/ftputil-${VERSION}/debian
106         cd ${DEBIAN_DIR}/ftputil-${VERSION} && \
107           dpkg-buildpackage -us -uc
108         # put the Debian package beneath the .tar.gz files
109         cp ${DEBIAN_DIR}/python-ftputil_${VERSION}-?_all.deb dist
110         # final check (better than nothing)
111         lintian ${DEBIAN_DIR}/python-ftputil_${VERSION}-?_all.deb
112
113 localcopy:
114         @echo "Copying archive and documentation to local webspace"
115         cp -p dist/ftputil-${VERSION}.tar.gz ${WWW_DIR}/download
116         cp -p ftputil.html ${WWW_DIR}/python
117         touch ${WWW_DIR}/python/python_software.tmpl
118
119 register:
120         @echo "Registering new version with PyPI"
121         python setup.py register
122
123 extdist: test dist debdist localcopy register
124
125 clean:
126         rm -f ${DOC_FILES}
127 # use absolute path to ensure we delete the right directory
128         rm -rf ${PROJECT_DIR}/build
129
Note: See TracBrowser for help on using the browser.