Skip to content

Commit

Permalink
uses versioneer
Browse files Browse the repository at this point in the history
  • Loading branch information
ddale committed Dec 16, 2015
1 parent bc3feb4 commit a95cda6
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 18 deletions.
3 changes: 3 additions & 0 deletions conda.recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
git describe --tags --dirty > %SRC_DIR%/__conda_version__.txt
%PYTHON% %RECIPE_DIR%/format_version.py %SRC_DIR%/__conda_version__.txt

%PYTHON% setup.py install
if errorlevel 1 exit 1
5 changes: 4 additions & 1 deletion conda.recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
$PYTHON setup.py install
git describe --tags --dirty > $SRC_DIR/__conda_version__.txt
$PYTHON $RECIPE_DIR/format_version.py $SRC_DIR/__conda_version__.txt

$PYTHON setup.py install
8 changes: 8 additions & 0 deletions conda.recipe/format_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os
import sys

fn = sys.argv[1]
with open(fn) as f:
s = f.read().lstrip('v').replace('-', '+', 1).replace('-', '.')
with open(fn, 'w') as f:
f.write(s)
7 changes: 2 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,11 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
with open('../quantities/version.py') as f:
for line in f:
if line.startswith('__version__'):
exec(line)
from quantities import __version__
# The short X.Y version.
version = __version__
# The full version, including alpha/beta/rc tags.
release = version
release = __version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
1 change: 1 addition & 0 deletions doc/rtd-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
numpydoc
13 changes: 7 additions & 6 deletions quantities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
>>> print pq.constants.proton_mass.simplified
1.672621637e-27 kg
+/-8.3e-35 kg (1 sigma)
A Latex representation of the dimensionality may be obtained in the following fashion::
>>> g = pq.Quantity(9.80665,'m/s**2')
Expand All @@ -225,12 +225,12 @@
>>> print weight.dimensionality.latex
$\\mathrm{N}$
The Latex output is compliant with the MathText subset used by Matplotlib. To add
The Latex output is compliant with the MathText subset used by Matplotlib. To add
formatted units to the axis label of a Matplotlib figure, one could use::
>>> ax.set_ylabel('Weight ' + weight.dimensionality.latex)
Greater customization is available via the markup.format_units_latex function. It allows
Greater customization is available via the markup.format_units_latex function. It allows
the user to modify the font, the multiplication symbol, or to encapsulate the latex
string in parentheses. Due to the complexity of CompoundUnits, the latex rendering
of CompoundUnits will utilize the latex \\frac{num}{den} construct.
Expand Down Expand Up @@ -267,7 +267,9 @@

from __future__ import absolute_import

from .version import __version__
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

from .registry import unit_registry

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

7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[versioneer]
VCS = git
style = pep440
versionfile_source = hexedd/_version.py
versionfile_build = hexedd/_version.py
tag_prefix = v
parentdir_prefix = hexedd-
20 changes: 14 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
from distutils.command.build import build as _build
import os

import versioneer


cmdclass = versioneer.get_cmdclass()


class data(Command):

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

cmdclass['data'] = data


class sdist(_sdist):

def run(self):
self.run_command('data')
_sdist.run(self)

cmdclass['sdist'] = sdist


class build(_build):

def run(self):
self.run_command('data')
_build.run(self)

cmdclass['build'] = build


class test(Command):

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

cmdclass['test'] = test


packages = []
for dirpath, dirnames, filenames in os.walk('quantities'):
Expand Down Expand Up @@ -107,12 +120,7 @@ def run(self):
# Topic :: Education
# Topic :: Scientific/Engineering
# """,
cmdclass = {
'build': build,
'data': data,
'sdist': sdist,
'test': test,
},
cmdclass = cmdclass,
description = "Support for physical quantities with units, based on numpy",
download_url = "http://pypi.python.org/pypi/quantities",
keywords = ['quantities', 'units', 'physical', 'constants'],
Expand Down

0 comments on commit a95cda6

Please sign in to comment.