diff options
author | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
commit | a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (patch) | |
tree | 45d462ed36a5522e9f3b9fde6c4ec4918c2ae8e3 /setup.py | |
parent | cebdc9244c019224846cb8d2668080fe386a6adc (diff) |
New upstream version 0.10.1+dfsg
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 71 |
1 files changed, 60 insertions, 11 deletions
@@ -2,7 +2,7 @@ # coding: utf8 # /*########################################################################## # -# Copyright (c) 2015-2018 European Synchrotron Radiation Facility +# Copyright (c) 2015-2019 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,7 +25,7 @@ # ###########################################################################*/ __authors__ = ["Jérôme Kieffer", "Thomas Vincent"] -__date__ = "23/04/2018" +__date__ = "12/02/2019" __license__ = "MIT" @@ -84,7 +84,10 @@ export LC_ALL=en_US.utf-8 def get_version(): """Returns current version number from version.py file""" + dirname = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, dirname) import version + sys.path = sys.path[1:] return version.strictversion @@ -345,8 +348,20 @@ if sphinx is not None: self.mkpath(self.builder_target_dir) BuildDoc.run(self) sys.path.pop(0) + + class BuildDocAndGenerateScreenshotCommand(BuildDocCommand): + def run(self): + old = os.environ.get('DIRECTIVE_SNAPSHOT_QT') + os.environ['DIRECTIVE_SNAPSHOT_QT'] = 'True' + BuildDocCommand.run(self) + if old is not None: + os.environ['DIRECTIVE_SNAPSHOT_QT'] = old + else: + del os.environ['DIRECTIVE_SNAPSHOT_QT'] + else: BuildDocCommand = SphinxExpectedCommand + BuildDocAndGenerateScreenshotCommand = SphinxExpectedCommand # ################### # @@ -588,7 +603,8 @@ class BuildExt(build_ext): from Cython.Build import cythonize patched_exts = cythonize( [ext], - compiler_directives={'embedsignature': True}, + compiler_directives={'embedsignature': True, + 'language_level': 3}, force=self.force_cython ) ext.sources = patched_exts[0].sources @@ -602,10 +618,15 @@ class BuildExt(build_ext): # Convert flags from gcc to MSVC if required if self.compiler.compiler_type == 'msvc': - ext.extra_compile_args = [self.COMPILE_ARGS_CONVERTER.get(f, f) - for f in ext.extra_compile_args] - ext.extra_link_args = [self.LINK_ARGS_CONVERTER.get(f, f) - for f in ext.extra_link_args] + extra_compile_args = [self.COMPILE_ARGS_CONVERTER.get(f, f) + for f in ext.extra_compile_args] + # Avoid empty arg + ext.extra_compile_args = [arg for arg in extra_compile_args if arg] + + extra_link_args = [self.LINK_ARGS_CONVERTER.get(f, f) + for f in ext.extra_link_args] + # Avoid empty arg + ext.extra_link_args = [arg for arg in extra_link_args if arg] elif self.compiler.compiler_type == 'unix': # Avoids runtime symbol collision for manylinux1 platform @@ -613,8 +634,17 @@ class BuildExt(build_ext): extern = 'extern "C" ' if ext.language == 'c++' else '' return_type = 'void' if sys.version_info[0] <= 2 else 'PyObject*' - ext.extra_compile_args.append( - '''-fvisibility=hidden -D'PyMODINIT_FUNC=%s__attribute__((visibility("default"))) %s ' ''' % (extern, return_type)) + ext.extra_compile_args.append('-fvisibility=hidden') + + import numpy + numpy_version = [int(i) for i in numpy.version.short_version.split(".", 2)[:2]] + if numpy_version < [1, 16]: + ext.extra_compile_args.append( + '''-D'PyMODINIT_FUNC=%s__attribute__((visibility("default"))) %s ' ''' % (extern, return_type)) + else: + ext.define_macros.append( + ('PyMODINIT_FUNC', + '%s__attribute__((visibility("default"))) %s ' % (extern, return_type))) def is_debug_interpreter(self): """ @@ -769,7 +799,8 @@ class SourceDistWithCython(sdist): from Cython.Build import cythonize cythonize( self.extensions, - compiler_directives={'embedsignature': True}, + compiler_directives={'embedsignature': True, + 'language_level': 3}, force=True ) @@ -859,7 +890,18 @@ def get_project_configuration(dry_run): "setuptools", # for io support "h5py", - "fabio>=0.7"] + "fabio>=0.7", + # Python 2/3 compatibility + "six", + ] + + # Add Python 2.7 backports + # Equivalent to but supported by old setuptools: + # "enum34; python_version == '2.7'", + # "futures; python_version == '2.7'", + if sys.version_info[0] == 2: + install_requires.append("enum34") + install_requires.append("futures") setup_requires = ["setuptools", "numpy"] @@ -882,6 +924,12 @@ def get_project_configuration(dry_run): 'full': full_requires, } + # Here for packaging purpose only + # Setting the SILX_FULL_INSTALL_REQUIRES environment variable + # put all dependencies as install_requires + if os.environ.get('SILX_FULL_INSTALL_REQUIRES') is not None: + install_requires += full_requires + package_data = { # Resources files for silx 'silx.resources': [ @@ -909,6 +957,7 @@ def get_project_configuration(dry_run): build=Build, build_py=build_py, test=PyTest, + build_screenshots=BuildDocAndGenerateScreenshotCommand, build_doc=BuildDocCommand, test_doc=TestDocCommand, build_ext=BuildExt, |