~ubuntu-branches/ubuntu/quantal/python-networkx/quantal

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Package Import Robot
  • Author(s): Sandro Tosi
  • Date: 2012-08-28 18:04:48 UTC
  • Revision ID: package-import@ubuntu.com-20120828180448-fifsfrlqdjutvolh
Tags: 1.7-2
* debian/*_objects.inv
  - updated intersphinx mapping files
* debian/rules
  - reorganize build and test targets
* debian/{control, rules}
  - provide Python 3 package; Closes: #597422

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/make -f
2
2
 
3
3
DEBIANDOC_DIR=$(CURDIR)/debian/python-networkx/usr/share/doc/python-networkx
4
 
PYLIBPATH := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_platlib")
 
4
LIB2 := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_platlib")
 
5
LIB3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_platlib)")
 
6
PYTHON2 := $(shell pyversions -r)
 
7
PYTHON3 := $(shell py3versions -r)
5
8
 
6
9
%:
7
 
        dh $@ --with sphinxdoc
 
10
        dh $@ --with sphinxdoc,python3
8
11
 
9
12
override_dh_auto_clean:
10
13
        dh_auto_clean
21
24
        # This directory is generated during the build
22
25
        rm -rf networkx.egg-info
23
26
 
24
 
build: build-arch build-indep ;
25
 
 
26
 
build-arch:
27
 
        dh build
28
 
 
 
27
override_dh_auto_build:
 
28
        dh_auto_build
 
29
 
 
30
        # build doc, run in a separate shell, so we can export MPLCONFIGDIR
 
31
        (export MPLCONFIGDIR=. ; make -C doc dist PYTHONPATH=../$(LIB2))
 
32
 
 
33
override_dh_auto_test:
 
34
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
 
35
        set -e ; \
29
36
        # running tests
30
 
        for py in $(shell pyversions -r) ; do\
31
 
                PYTHONPATH=$(PYLIBPATH) $$py setup_egg.py nosetests ; \
32
 
        done
33
 
 
34
 
build-indep:
35
 
        # build doc, run in a separate shell, so we can export MPLCONFIGDIR
36
 
        (export MPLCONFIGDIR=. ; make -C doc dist PYTHONPATH=../$(PYLIBPATH))
 
37
        for py in $(PYTHON2) ; do\
 
38
                PYTHONPATH=$(LIB2) $$py setup_egg.py nosetests ; \
 
39
        done
 
40
        set -e ; \
 
41
        # running tests Python 3
 
42
        for py in $(PYTHON3) ; do\
 
43
                PYTHONPATH=$(LIB3) $$py setup_egg.py nosetests ; \
 
44
        done
 
45
endif
37
46
 
38
47
override_dh_install:
39
48
        # Install w/o compiling *.pyc files
40
49
        # Install egg-info directories (--single-... option)
41
50
        python setup_egg.py install --no-compile --root=$(CURDIR)/debian/python-networkx \
42
51
                --single-version-externally-managed --install-layout=deb
 
52
        python3 setup_egg.py install --no-compile --root=$(CURDIR)/debian/python3-networkx \
 
53
                --single-version-externally-managed --install-layout=deb
43
54
 
44
55
        # Fix executable bits:
45
56
        chmod +x debian/python-networkx/usr/lib/`pyversions -d`/*-packages/networkx/tests/test.py
 
57
        chmod +x debian/python3-networkx/usr/lib/*/*-packages/networkx/tests/test.py
46
58
        find debian/python-networkx -name '*.bz2' -exec chmod a-x {} ';'
47
59
 
 
60
        # fix test shebang
 
61
        sed 's|/usr/bin/env python|/usr/bin/python3|' -i debian/python3-networkx/usr/lib/*/*-packages/networkx/tests/test.py
 
62
 
 
63
        # remove duplicate examples
 
64
        rm -rf debian/python3-networkx/usr/share/doc/python-networkx
 
65
 
 
66
        # don't ship python 2 code for _decorator because it can't be byte-compiled
 
67
        rm -f debian/python3-networkx/usr/lib/python3/dist-packages/networkx/external/decorator/_decorator.py
 
68
 
48
69
        # Do some cleanup: delete unneeded files:
49
70
        rm $(DEBIANDOC_DIR)/INSTALL.txt $(DEBIANDOC_DIR)/LICENSE.txt
50
71