diff options
-rwxr-xr-x | debian.py3k/rules | 6 | ||||
-rw-r--r-- | setup.py | 31 |
2 files changed, 30 insertions, 7 deletions
diff --git a/debian.py3k/rules b/debian.py3k/rules index 8b17d16..2352058 100755 --- a/debian.py3k/rules +++ b/debian.py3k/rules @@ -12,22 +12,16 @@ #export DH_VERBOSE=1 PACKAGE:=$(shell grep Package debian/control | cut -d ' ' -f2) -PYDEF:=$(shell py3versions -dv) include /usr/share/python3/python.mk %: dh --with python3 $@ -override_dh_auto_build: - # python module build - NO_SETUPTOOLS=1 python3 setup.py -q build --build-purelib $(CURDIR)/build/lib - override_dh_install: NO_SETUPTOOLS=1 python3 setup.py -q install --no-compile \ --root=$(CURDIR)/debian/$(PACKAGE)/ \ ${py_setup_install_args} - find $(CURDIR)/debian/$(PACKAGE)/usr/lib/python*/*-packages/ ! -path "*/test/*py" -name "*py" -exec 2to3-$(PYDEF) -wn {} \; # rename executables for executable in pylint pylint-gui symilar epylint pyreverse ; do \ new_exec="$$executable"3; \ @@ -38,6 +38,34 @@ except ImportError: from distutils.command import install_lib USE_SETUPTOOLS = 0 +# pylint needs to filter some test files expected to be wrong +P3K_FILES_TO_IGNORE= ['test/input/func_wrong_encoding.py', + 'test/input/func_noerror_encoding.py', + 'test/input/func_unknown_encoding.py', + 'test/input/func_nonascii_noencoding.py'] +try: + # python3 + from distutils.command.build_py import build_py_2to3 as build_py + def run(self): + self.updated_files = [] + # Base class code + if self.py_modules: + self.build_modules() + if self.packages: + self.build_packages() + self.build_package_data() + # filter test files + self.updated_files = [f for f in self.updated_files + if not f.endswith(tuple(P3K_FILES_TO_IGNORE))] + # 2to3 + self.run_2to3(self.updated_files) + # Remaining base class code + self.byte_compile(self.get_outputs(include_bytecode=0)) + build_py.run = run +except ImportError: + # python2.x + from distutils.command.build_py import build_py + sys.modules.pop('__pkginfo__', None) # import optional features __pkginfo__ = __import__("__pkginfo__") @@ -154,7 +182,8 @@ def install(**kwargs): scripts = ensure_scripts(scripts), data_files = data_files, ext_modules = ext_modules, - cmdclass = {'install_lib': MyInstallLib}, + cmdclass = {'install_lib': MyInstallLib, + 'build_py': build_py}, **kwargs ) |