diff options
author | Picca Frédéric-Emmanuel <picca@debian.org> | 2017-10-07 07:59:01 +0200 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@debian.org> | 2017-10-07 07:59:01 +0200 |
commit | bfa4dba15485b4192f8bbe13345e9658c97ecf76 (patch) | |
tree | fb9c6e5860881fbde902f7cbdbd41dc4a3a9fb5d /setup.py | |
parent | f7bdc2acff3c13a6d632c28c4569690ab106eed7 (diff) |
New upstream version 0.6.0+dfsg
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 74 |
1 files changed, 66 insertions, 8 deletions
@@ -25,7 +25,7 @@ # ###########################################################################*/ __authors__ = ["Jérôme Kieffer", "Thomas Vincent"] -__date__ = "04/05/2017" +__date__ = "02/10/2017" __license__ = "MIT" @@ -106,7 +106,6 @@ classifiers = ["Development Status :: 4 - Beta", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", - "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", "Natural Language :: English", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", @@ -115,6 +114,7 @@ classifiers = ["Development Status :: 4 - Beta", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering :: Physics", "Topic :: Software Development :: Libraries :: Python Modules", @@ -152,7 +152,7 @@ class PyTest(Command): def run(self): import subprocess - errno = subprocess.call([sys.executable, 'run_tests.py', '-i']) + errno = subprocess.call([sys.executable, 'run_tests.py']) if errno != 0: raise SystemExit(errno) @@ -441,7 +441,6 @@ class Build(_build): logger.warning(msg) use_cython = "no" - # Remove attribute used by distutils parsing # use 'use_cython' and 'force_cython' instead del self.no_cython @@ -461,7 +460,7 @@ class BuildExt(build_ext): COMPILE_ARGS_CONVERTER = {'-fopenmp': '/openmp'} - LINK_ARGS_CONVERTER = {'-fopenmp': ' '} + LINK_ARGS_CONVERTER = {'-fopenmp': ''} description = 'Build silx extensions' @@ -530,7 +529,63 @@ class BuildExt(build_ext): ext.extra_link_args = [self.LINK_ARGS_CONVERTER.get(f, f) for f in ext.extra_link_args] + def is_debug_interpreter(self): + """ + Returns true if the script is executed with a debug interpreter. + + It looks to be a non-standard code. It is not working for Windows and + Mac. But it have to work at least for Debian interpreters. + + :rtype: bool + """ + if sys.version_info >= (3, 0): + # It is normalized on Python 3 + # But it is not available on Windows CPython + if hasattr(sys, "abiflags"): + return "d" in sys.abiflags + else: + # It's a Python 2 interpreter + # pydebug is not available on Windows/Mac OS interpreters + if hasattr(sys, "pydebug"): + return sys.pydebug + + # We can't know if we uses debug interpreter + return False + + def patch_compiler(self): + """ + Patch the compiler to: + - always compile extensions with debug symboles (-g) + - only compile asserts in debug mode (-DNDEBUG) + + Plus numpy.distutils/setuptools/distutils inject a lot of duplicated + flags. This function tries to clean up default debug options. + """ + build_obj = self.distribution.get_command_obj("build") + if build_obj.debug: + debug_mode = build_obj.debug + else: + # Force debug_mode also when it uses python-dbg + # It is needed for Debian packaging + debug_mode = self.is_debug_interpreter() + + if self.compiler.compiler_type == "unix": + args = list(self.compiler.compiler_so) + # clean up debug flags -g is included later in another way + must_be_cleaned = ["-DNDEBUG", "-g"] + args = filter(lambda x: x not in must_be_cleaned, args) + args = list(args) + + # always insert symbols + args.append("-g") + # only strip asserts in release mode + if not debug_mode: + args.append('-DNDEBUG') + # patch options + self.compiler.compiler_so = list(args) + def build_extensions(self): + self.patch_compiler() for ext in self.extensions: self.patch_extension(ext) build_ext.build_extensions(self) @@ -654,15 +709,18 @@ def get_project_configuration(dry_run): setup_requires = ["setuptools", "numpy"] package_data = { + # Resources files for silx 'silx.resources': [ - # Add here all resources files + 'gui/logo/*.png', + 'gui/logo/*.svg', 'gui/icons/*.png', 'gui/icons/*.svg', 'gui/icons/*.mng', 'gui/icons/*.gif', - 'gui/icons/animated/*.png', + 'gui/icons/*/*.png', 'opencl/*.cl', - 'opencl/sift/*.cl'] + 'opencl/sift/*.cl', + 'gui/colormaps/*.npy'], } entry_points = { |