Skip to content

Commit 49801d7

Browse files
committed
Merge pull request #46 from mdickinson/fix/version-number
Add bigfloat.__version__ and centralise version numbers.
2 parents 26102d6 + 5018499 commit 49801d7

7 files changed

Lines changed: 65 additions & 7 deletions

File tree

INSTALL.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Installation from a release tarball
1414
The instructions cover installation from either a repository clone,
1515
or a source distribution tarball. After cloning the repository
1616
or unpacking the tarball, you should have a top-level directory
17-
named something like ``bigfloat-0.3.0``.
17+
named something like ``bigfloat-0.4.0``.
1818

1919
(1) Enter that top-level directory and execute the command::
2020

@@ -62,7 +62,7 @@ named something like ``bigfloat-0.3.0``.
6262
...
6363
1.4142135623730950488016887242096980785696718753769480731766796
6464

65-
If installation was successful, the ``bigfloat-0.3.0`` directory that you
65+
If installation was successful, the ``bigfloat-0.4.0`` directory that you
6666
created can now be deleted.
6767

6868

RELEASING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Notes on creating a release. These notes apply my own system, currently OS X
88

99
1. Create a release branch::
1010

11-
git checkout release/0.3.0
11+
git checkout release/0.4.0
1212

1313
2. Update version numbers if necessary. Places that need to be updated
1414
include::
@@ -27,7 +27,7 @@ Notes on creating a release. These notes apply my own system, currently OS X
2727

2828
4. When satisfied, tag the release::
2929

30-
git tag -a v0.3.0
30+
git tag -a v0.4.0
3131

3232
5. Upload the release to PyPI. Register first if necessary::
3333

bigfloat/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
# along with the bigfloat package. If not, see <http://www.gnu.org/licenses/>.
1717

1818
__all__ = [
19+
# version string for bigfloat
20+
'__version__',
21+
1922
# main class
2023
'BigFloat',
2124

@@ -167,6 +170,8 @@
167170

168171
)
169172

173+
from bigfloat.version import __version__
174+
170175
from mpfr import (
171176
# MPFR Version information
172177
MPFR_VERSION,

bigfloat/test/test_bigfloat.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
_builtin_abs = abs
3232

3333
from bigfloat import (
34+
# version number
35+
__version__,
36+
3437
# main class
3538
BigFloat,
3639

@@ -133,6 +136,9 @@ class BigFloatTests(unittest.TestCase):
133136
def setUp(self):
134137
setcontext(DefaultContext)
135138

139+
def test_version(self):
140+
self.assertIsInstance(__version__, str)
141+
136142
def assertIdenticalFloat(self, x, y):
137143
if not (isinstance(x, float) and isinstance(y, float)):
138144
raise ValueError("Expected x and y to be floats "

bigfloat/version.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2009--2014 Mark Dickinson.
2+
#
3+
# This file is part of the bigfloat package.
4+
#
5+
# The bigfloat package is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU Lesser General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or (at your
8+
# option) any later version.
9+
#
10+
# The bigfloat package is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13+
# for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with the bigfloat package. If not, see <http://www.gnu.org/licenses/>.
17+
18+
major = 0
19+
minor = 4
20+
patch = 0
21+
prerelease = 'dev'
22+
23+
if prerelease:
24+
__version__ = "{0}.{1}.{2}-{3}".format(major, minor, patch, prerelease)
25+
else:
26+
__version__ = "{0}.{1}.{2}".format(major, minor, patch)
27+
28+
# Release and version for Sphinx purposes.
29+
30+
# The short X.Y version.
31+
version = "{0}.{1}".format(major, minor)
32+
33+
# The full version, including patchlevel and alpha/beta/rc tags.
34+
release = __version__

docs/source/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@
5959
# built documents.
6060
#
6161
# The short X.Y version.
62-
version = '0.3'
62+
import bigfloat.version
63+
version = bigfloat.version.version
64+
6365
# The full version, including alpha/beta/rc tags.
64-
release = '0.3.0'
66+
release = bigfloat.version.release
6567

6668
# The language for content autogenerated by Sphinx. Refer to documentation
6769
# for a list of supported languages.

setup.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,20 @@
247247
""".splitlines()
248248

249249

250+
def get_version_info():
251+
"""Extract version information as a dictionary from version.py."""
252+
version_info = {}
253+
with open(os.path.join("bigfloat", "version.py"), 'r') as f:
254+
version_code = compile(f.read(), "version.py", 'exec')
255+
exec(version_code, version_info)
256+
return version_info
257+
258+
259+
version_info = get_version_info()
260+
250261
setup(
251262
name='bigfloat',
252-
version='0.3.0',
263+
version=version_info,
253264
description=DESCRIPTION,
254265
long_description=LONG_DESCRIPTION,
255266
author='Mark Dickinson',

0 commit comments

Comments
 (0)