Skip to content

Commit 5e1a703

Browse files
authored
Fix packaging (#3)
1 parent 4a4ba29 commit 5e1a703

File tree

5 files changed

+47
-38
lines changed

5 files changed

+47
-38
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
#########
33

4+
v0.2.1 : Fix packaging
5+
----------------------
6+
7+
Version 0.2.0 had some problems with the way it was packaged on PyPi and
8+
conda-forge. Nothing changed in the code itself.
9+
410

511
v0.2.0 : First packaged release
612
-------------------------------

MANIFEST.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
prune tests
2-
exclude requirements.txt
3-
exclude requirements-dev.txt
4-
exclude .gitignore
5-
exclude .travis.yml
1+
include README.rst
2+
include CHANGELOG.rst
3+
include LICENSE

fftlog/__init__.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
from datetime import datetime
21
from fftlog._fftlog import fhti, fftl, fht, fhtq
32

43
__all__ = ['fhti', 'fftl', 'fht', 'fhtq']
54

65
# Version
7-
try:
8-
# - Released versions just tags: 1.10.0
9-
# - GitHub commits add .dev#+hash: 1.10.1.dev3+g973038c
10-
# - Uncommitted changes add timestamp: 1.10.1.dev3+g973038c.d20191022
11-
from .version import version as __version__
12-
except ImportError:
13-
# If it was not installed, then we don't know the version. We could throw a
14-
# warning here, but this case *should* be rare. fftlog should be installed
15-
# properly!
16-
__version__ = 'unknown-'+datetime.today().strftime('%Y%m%d')
6+
# Not using setuptools_scm, as in pyfftlog, because of numpy-setup.
7+
# Has to be adjusted in setup.py too!
8+
__version__ = '0.2.1'

requirements-dev.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# GLOBAL REQUIREMENTS
22
-r requirements.txt
33

4-
# SETUP RELATED
5-
setuptools_scm
6-
74
# FOR TESTING
85
pytest
96
coveralls

setup.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# -*- coding: utf-8 -*-
2-
import os
32
import re
4-
from numpy.distutils.core import setup, Extension
3+
import sys
54

65
# Get README and remove badges.
76
readme = open('README.rst').read()
87
readme = re.sub('.*`fftlog` - A', '`fftlog` - A', readme, flags=re.DOTALL)
98

10-
setup(
9+
metadata = dict(
1110
name='fftlog',
11+
version='0.2.1', # Adjust in fftlog/__init__.py too!
1212
description='Logarithmic Fast Fourier Transform',
1313
long_description=readme,
1414
author='Dieter Werthmüller',
@@ -17,7 +17,35 @@
1717
license='CC0-1.0',
1818
packages=['fftlog', ],
1919
include_package_data=True,
20-
ext_modules=[
20+
classifiers=[
21+
'Development Status :: 5 - Production/Stable',
22+
'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
23+
],
24+
install_requires=[
25+
'scipy',
26+
],
27+
# setup_requires=['numpy', ],
28+
)
29+
30+
31+
bdist = ('bdist_wheel', 'bdist_egg')
32+
nonumpy = ('--help-commands', 'egg_info', '--version', 'clean')
33+
argv2 = len(sys.argv) >= 2
34+
if argv2 and ('--help' in sys.argv[1:] or sys.argv[1] in nonumpy):
35+
# For these actions, NumPy is not required.
36+
#
37+
# They are required to succeed without Numpy, for example when pip is
38+
# used to install fftlog when Numpy is not yet present in the system.
39+
from setuptools import setup
40+
else:
41+
if (argv2 >= 2 and sys.argv[1] in bdist) or ('develop' in sys.argv):
42+
43+
# bdist_wheel/bdist_egg needs setuptools
44+
import setuptools # noqa
45+
46+
from numpy.distutils.core import setup, Extension
47+
48+
metadata['ext_modules'] = [
2149
Extension(
2250
name="fftlog._fftlog",
2351
sources=['fftlog/fftlog.pyf', ] +
@@ -27,18 +55,6 @@
2755
'fftlog/src/fftlog.f'
2856
],
2957
)
30-
],
31-
classifiers=[
32-
'Development Status :: 5 - Production/Stable',
33-
'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
34-
],
35-
install_requires=[
36-
'scipy',
37-
],
38-
use_scm_version={
39-
'root': '.',
40-
'relative_to': __file__,
41-
'write_to': os.path.join('fftlog', 'version.py'),
42-
},
43-
setup_requires=['setuptools_scm'],
44-
)
58+
]
59+
60+
setup(**metadata)

0 commit comments

Comments
 (0)