diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ddc92e9..da55d7f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ######### +v0.2.1 : Fix packaging +---------------------- + +Version 0.2.0 had some problems with the way it was packaged on PyPi and +conda-forge. Nothing changed in the code itself. + v0.2.0 : First packaged release ------------------------------- diff --git a/MANIFEST.in b/MANIFEST.in index 105bdf8..a4f4cc9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,3 @@ -prune tests -exclude requirements.txt -exclude requirements-dev.txt -exclude .gitignore -exclude .travis.yml +include README.rst +include CHANGELOG.rst +include LICENSE diff --git a/fftlog/__init__.py b/fftlog/__init__.py index 1e14629..4ede578 100644 --- a/fftlog/__init__.py +++ b/fftlog/__init__.py @@ -1,16 +1,8 @@ -from datetime import datetime from fftlog._fftlog import fhti, fftl, fht, fhtq __all__ = ['fhti', 'fftl', 'fht', 'fhtq'] # Version -try: - # - Released versions just tags: 1.10.0 - # - GitHub commits add .dev#+hash: 1.10.1.dev3+g973038c - # - Uncommitted changes add timestamp: 1.10.1.dev3+g973038c.d20191022 - from .version import version as __version__ -except ImportError: - # If it was not installed, then we don't know the version. We could throw a - # warning here, but this case *should* be rare. fftlog should be installed - # properly! - __version__ = 'unknown-'+datetime.today().strftime('%Y%m%d') +# Not using setuptools_scm, as in pyfftlog, because of numpy-setup. +# Has to be adjusted in setup.py too! +__version__ = '0.2.1' diff --git a/requirements-dev.txt b/requirements-dev.txt index dfb2937..02c654b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,9 +1,6 @@ # GLOBAL REQUIREMENTS -r requirements.txt -# SETUP RELATED -setuptools_scm - # FOR TESTING pytest coveralls diff --git a/setup.py b/setup.py index 1142563..a1e3c2a 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- -import os import re -from numpy.distutils.core import setup, Extension +import sys # Get README and remove badges. readme = open('README.rst').read() readme = re.sub('.*`fftlog` - A', '`fftlog` - A', readme, flags=re.DOTALL) -setup( +metadata = dict( name='fftlog', + version='0.2.1', # Adjust in fftlog/__init__.py too! description='Logarithmic Fast Fourier Transform', long_description=readme, author='Dieter Werthmüller', @@ -17,7 +17,35 @@ license='CC0-1.0', packages=['fftlog', ], include_package_data=True, - ext_modules=[ + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication', + ], + install_requires=[ + 'scipy', + ], + # setup_requires=['numpy', ], +) + + +bdist = ('bdist_wheel', 'bdist_egg') +nonumpy = ('--help-commands', 'egg_info', '--version', 'clean') +argv2 = len(sys.argv) >= 2 +if argv2 and ('--help' in sys.argv[1:] or sys.argv[1] in nonumpy): + # For these actions, NumPy is not required. + # + # They are required to succeed without Numpy, for example when pip is + # used to install fftlog when Numpy is not yet present in the system. + from setuptools import setup +else: + if (argv2 >= 2 and sys.argv[1] in bdist) or ('develop' in sys.argv): + + # bdist_wheel/bdist_egg needs setuptools + import setuptools # noqa + + from numpy.distutils.core import setup, Extension + + metadata['ext_modules'] = [ Extension( name="fftlog._fftlog", sources=['fftlog/fftlog.pyf', ] + @@ -27,18 +55,6 @@ 'fftlog/src/fftlog.f' ], ) - ], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication', - ], - install_requires=[ - 'scipy', - ], - use_scm_version={ - 'root': '.', - 'relative_to': __file__, - 'write_to': os.path.join('fftlog', 'version.py'), - }, - setup_requires=['setuptools_scm'], -) + ] + +setup(**metadata)