Skip to content

Commit a95cda6

Browse files
committed
uses versioneer
1 parent bc3feb4 commit a95cda6

File tree

8 files changed

+46
-18
lines changed

8 files changed

+46
-18
lines changed

conda.recipe/bld.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
git describe --tags --dirty > %SRC_DIR%/__conda_version__.txt
2+
%PYTHON% %RECIPE_DIR%/format_version.py %SRC_DIR%/__conda_version__.txt
3+
14
%PYTHON% setup.py install
25
if errorlevel 1 exit 1

conda.recipe/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
$PYTHON setup.py install
1+
git describe --tags --dirty > $SRC_DIR/__conda_version__.txt
2+
$PYTHON $RECIPE_DIR/format_version.py $SRC_DIR/__conda_version__.txt
3+
4+
$PYTHON setup.py install

conda.recipe/format_version.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import os
2+
import sys
3+
4+
fn = sys.argv[1]
5+
with open(fn) as f:
6+
s = f.read().lstrip('v').replace('-', '+', 1).replace('-', '.')
7+
with open(fn, 'w') as f:
8+
f.write(s)

doc/conf.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,11 @@
4848
# |version| and |release|, also used in various other places throughout the
4949
# built documents.
5050
#
51-
with open('../quantities/version.py') as f:
52-
for line in f:
53-
if line.startswith('__version__'):
54-
exec(line)
51+
from quantities import __version__
5552
# The short X.Y version.
5653
version = __version__
5754
# The full version, including alpha/beta/rc tags.
58-
release = version
55+
release = __version__
5956

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

doc/rtd-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
numpydoc

quantities/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
>>> print pq.constants.proton_mass.simplified
214214
1.672621637e-27 kg
215215
+/-8.3e-35 kg (1 sigma)
216-
216+
217217
A Latex representation of the dimensionality may be obtained in the following fashion::
218218
219219
>>> g = pq.Quantity(9.80665,'m/s**2')
@@ -225,12 +225,12 @@
225225
>>> print weight.dimensionality.latex
226226
$\\mathrm{N}$
227227
228-
The Latex output is compliant with the MathText subset used by Matplotlib. To add
228+
The Latex output is compliant with the MathText subset used by Matplotlib. To add
229229
formatted units to the axis label of a Matplotlib figure, one could use::
230230
231231
>>> ax.set_ylabel('Weight ' + weight.dimensionality.latex)
232-
233-
Greater customization is available via the markup.format_units_latex function. It allows
232+
233+
Greater customization is available via the markup.format_units_latex function. It allows
234234
the user to modify the font, the multiplication symbol, or to encapsulate the latex
235235
string in parentheses. Due to the complexity of CompoundUnits, the latex rendering
236236
of CompoundUnits will utilize the latex \\frac{num}{den} construct.
@@ -267,7 +267,9 @@
267267

268268
from __future__ import absolute_import
269269

270-
from .version import __version__
270+
from ._version import get_versions
271+
__version__ = get_versions()['version']
272+
del get_versions
271273

272274
from .registry import unit_registry
273275

@@ -290,4 +292,3 @@ def test(verbosity=1):
290292
import unittest
291293
suite = unittest.TestLoader().discover('quantities')
292294
unittest.TextTestRunner(verbosity=verbosity).run(suite)
293-

setup.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[versioneer]
2+
VCS = git
3+
style = pep440
4+
versionfile_source = hexedd/_version.py
5+
versionfile_build = hexedd/_version.py
6+
tag_prefix = v
7+
parentdir_prefix = hexedd-

setup.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
from distutils.command.build import build as _build
55
import os
66

7+
import versioneer
8+
9+
10+
cmdclass = versioneer.get_cmdclass()
11+
712

813
class data(Command):
914

@@ -38,20 +43,26 @@ def run(self):
3843
%(val, prec, unit)
3944
f.write("physical_constants['%s'] = %s\n"%(name, d))
4045

46+
cmdclass['data'] = data
47+
4148

4249
class sdist(_sdist):
4350

4451
def run(self):
4552
self.run_command('data')
4653
_sdist.run(self)
4754

55+
cmdclass['sdist'] = sdist
56+
4857

4958
class build(_build):
5059

5160
def run(self):
5261
self.run_command('data')
5362
_build.run(self)
5463

64+
cmdclass['build'] = build
65+
5566

5667
class test(Command):
5768

@@ -79,6 +90,8 @@ def run(self):
7990
suite = unittest.TestLoader().discover('.')
8091
unittest.TextTestRunner(verbosity=self.verbosity+1).run(suite)
8192

93+
cmdclass['test'] = test
94+
8295

8396
packages = []
8497
for dirpath, dirnames, filenames in os.walk('quantities'):
@@ -107,12 +120,7 @@ def run(self):
107120
# Topic :: Education
108121
# Topic :: Scientific/Engineering
109122
# """,
110-
cmdclass = {
111-
'build': build,
112-
'data': data,
113-
'sdist': sdist,
114-
'test': test,
115-
},
123+
cmdclass = cmdclass,
116124
description = "Support for physical quantities with units, based on numpy",
117125
download_url = "http://pypi.python.org/pypi/quantities",
118126
keywords = ['quantities', 'units', 'physical', 'constants'],

0 commit comments

Comments
 (0)