Differences between revisions 3 and 4
Revision 3 as of 2014-02-02 07:53:51
Size: 220
Editor: ?SiennaMcG
Comment:
Revision 4 as of 2014-02-02 08:01:55
Size: 2017
Editor: GeoffSimmons
Comment: Spam.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
I'm Kattie and I live in Aschelberg. <<BR>>
I'm interested in International Relations, Taxidermy and Portuguese art. I like travelling and reading fantasy.<<BR>>
<<BR>>
Here is my page [[http://kieskwies.eu|gadget]]
Similar to [[Python/LibraryStyleGuide]] here are some additional approaches.

If you install a single package with scripts and a public module, and would like to provide both python2 and python3 public modules (because you don't know if someone is relying on them), and want to choose which python to use for your scripts you can follow one of these recipes for python2/3 dual packaging.

{{{
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

PYTHON2_VERSIONS = $(shell pyversions -r)
PYTHON3_VERSIONS = $(shell py3versions -r)
py3sdo = set -e; $(foreach py, $(PYTHON3_VERSIONS), $(py) $(1);)
pyalldo = set -e; $(foreach py, $(PYTHON2_VERSIONS) $(PYTHON3_VERSIONS), $(py) $(1);)

%:
 dh $@ --with python2,python3

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
 $(call pyalldo, -m unittest discover -vv test/)
endif

override_dh_auto_build:
 dh_auto_build
 $(call py3sdo, setup.py build)

override_dh_auto_install:
        # whichever called last, will result in shebang update
        # in this case, the scripts will end up with python3 shebang
        # reverse the order if you want to continue using python2 shebang
 dh_auto_install
 $(call py3sdo, setup.py install --root=$(CURDIR)/debian/$(DEB_SOURCE) --install-layout=deb)

override_dh_auto_clean:
 dh_auto_clean
 rm -rf build
 rm -rf *.egg-info
}}}

If you don't like GNU Make $(call) function

{{{
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

PYTHON2_VERSIONS = $(shell pyversions -r)
PYTHON3_VERSIONS = $(shell py3versions -r)

%:
 dh "$@" --with python2,python3

override_dh_auto_clean:
 dh_auto_clean
 rm -rf build

override_dh_auto_build:
 dh_auto_build
 set -ex; for python in $(PYTHON3_VERSIONS); do \
         $$python setup.py build; \
 done

override_dh_auto_install:
 dh_auto_install
 set -ex; for python in $(PYTHON3_VERSIONS); do \
         $$python setup.py install --root=$(CURDIR)/debian/$(DEB_SOURCE) --install-layout=deb; \
 done
}}}

Similar to Python/LibraryStyleGuide here are some additional approaches.

If you install a single package with scripts and a public module, and would like to provide both python2 and python3 public modules (because you don't know if someone is relying on them), and want to choose which python to use for your scripts you can follow one of these recipes for python2/3 dual packaging.

include /usr/share/dpkg/pkg-info.mk

PYTHON2_VERSIONS = $(shell pyversions -r)
PYTHON3_VERSIONS = $(shell py3versions -r)
py3sdo = set -e; $(foreach py, $(PYTHON3_VERSIONS), $(py) $(1);)
pyalldo = set -e; $(foreach py, $(PYTHON2_VERSIONS) $(PYTHON3_VERSIONS), $(py) $(1);)

%:
        dh $@ --with python2,python3

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
        $(call pyalldo, -m unittest discover -vv test/)
endif

override_dh_auto_build:
        dh_auto_build
        $(call py3sdo, setup.py build)

override_dh_auto_install:
        # whichever called last, will result in shebang update
        # in this case, the scripts will end up with python3 shebang
        # reverse the order if you want to continue using python2 shebang
        dh_auto_install
        $(call py3sdo, setup.py install --root=$(CURDIR)/debian/$(DEB_SOURCE) --install-layout=deb)

override_dh_auto_clean:
        dh_auto_clean
        rm -rf build
        rm -rf *.egg-info

If you don't like GNU Make $(call) function

include /usr/share/dpkg/pkg-info.mk

PYTHON2_VERSIONS = $(shell pyversions -r)
PYTHON3_VERSIONS = $(shell py3versions -r)

%:
        dh "$@" --with python2,python3

override_dh_auto_clean:
        dh_auto_clean
        rm -rf build

override_dh_auto_build:
        dh_auto_build
        set -ex; for python in $(PYTHON3_VERSIONS); do \
                $$python setup.py build; \
        done

override_dh_auto_install:
        dh_auto_install
        set -ex; for python in $(PYTHON3_VERSIONS); do \
                $$python setup.py install --root=$(CURDIR)/debian/$(DEB_SOURCE) --install-layout=deb; \
        done