Skip to content

Commit

Permalink
Fix packaging (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
prisae committed May 22, 2020
1 parent 4a4ba29 commit 5e1a703
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 38 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
-------------------------------
Expand Down
8 changes: 3 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
14 changes: 3 additions & 11 deletions fftlog/__init__.py
Original file line number Diff line number Diff line change
@@ -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'
3 changes: 0 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# GLOBAL REQUIREMENTS
-r requirements.txt

# SETUP RELATED
setuptools_scm

# FOR TESTING
pytest
coveralls
Expand Down
54 changes: 35 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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', ] +
Expand All @@ -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)

0 comments on commit 5e1a703

Please sign in to comment.