From eadc845e6b2601da7a2d733c0e3c13b9fcf194f5 Mon Sep 17 00:00:00 2001 From: Ghislain Antony Vaillant Date: Wed, 30 Jul 2014 11:10:47 +0100 Subject: [PATCH] fix #37: package version conform with pep-396 --- .gitignore | 1 + pynfft/__init__.py | 1 + setup.py | 36 +++++++++++++++++++++++++++++------- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 94b5038..a05bf9e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ dist/ *.egg-info/ doc/build MANIFEST +pynfft/version.py diff --git a/pynfft/__init__.py b/pynfft/__init__.py index 71b1808..1885190 100644 --- a/pynfft/__init__.py +++ b/pynfft/__init__.py @@ -16,5 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from pynfft.version import version as __version__ from pynfft.nfft import NFFT from pynfft.solver import Solver diff --git a/setup.py b/setup.py index bc94b63..b988986 100644 --- a/setup.py +++ b/setup.py @@ -107,11 +107,11 @@ ), ] - -version = '1.3.1' -release = True -if not release: - version += '-dev' +MAJOR = 1 +MINOR = 3 +MICRO = 1 +SUFFIX = "" # Should be blank except for rc's, betas, etc. +VERSION = '%d.%d.%d%s' % (MAJOR, MINOR, MICRO, SUFFIX) long_description = '''"The NFFT is a C subroutine library for computing the nonequispaced discrete Fourier transform (NDFT) in one or more dimensions, of @@ -144,7 +144,7 @@ setup_args = { 'name': 'pyNFFT', - 'version': version, + 'version': VERSION, 'author': 'Ghislain Vaillant', 'author_email': 'ghisvail@gmail.com', 'description': 'A pythonic wrapper around NFFT', @@ -159,5 +159,27 @@ 'install_requires': ['numpy'], } -if __name__ == '__main__': + +# borrowed from pandas / theano +def write_version_py(filename=None): + cnt = """\ +version = '%s' +""" + if not filename: + filename = os.path.join( + os.path.dirname(__file__), 'pynfft', 'version.py') + + a = open(filename, 'w') + try: + a.write(cnt % (VERSION,)) + finally: + a.close() + + +def do_setup(): + write_version_py() setup(**setup_args) + + +if __name__ == '__main__': + do_setup()