Skip to content

Commit

Permalink
Simplify versioning code
Browse files Browse the repository at this point in the history
  • Loading branch information
moble committed Oct 16, 2017
1 parent 46501fd commit b732124
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deploy/build_macosx_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for CONDA_ENV in "${CONDA_ENVS[@]}"; do
source activate "${CONDA_ENV}"
# Install packages and test ability to import and run simple command
pip install --upgrade spinsfast --no-index -f "${wheelhouse}"
(cd "$HOME"; python -c 'import numpy as np; import quatrernion; print(quaternion.__version__); print("quaternion.z = {0}".format(quaternion.z))')
(cd "$HOME"; python -c 'import numpy as np; import quaternion; print(quaternion.__version__); print("quaternion.z = {0}".format(quaternion.z))')
source deactivate
done

Expand Down
2 changes: 1 addition & 1 deletion deploy/build_manylinux_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ done
for PYBIN in "${PYBINS[@]}"; do
# Install packages and test ability to import and run simple command
"${PYBIN}/pip" install spinsfast --no-index -f /wheelhouse
(cd "$HOME"; "${PYBIN}/python" -c 'import numpy as np; import quatrernion; print(quaternion.__version__); print("quaternion.z = {0}".format(quaternion.z))')
(cd "$HOME"; "${PYBIN}/python" -c 'import numpy as np; import quaternion; print(quaternion.__version__); print("quaternion.z = {0}".format(quaternion.z))')
done


Expand Down
25 changes: 15 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@
# Copyright (c) 2017, Michael Boyle
# See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE>

from auto_version import calculate_version, build_py_copy_version
# Construct the version number, starting with spinsfast's own version (104) and appending the date
# and time this python version was created.
if "datetime" in environ:
version = environ["package_version"]
else:
try:
from subprocess import check_output
version = check_output("""git log -1 --format=%cd --date=format:'%Y.%m.%d.%H.%M.%S'""", shell=use_shell).decode('ascii').rstrip()
except:
from time import strftime, gmtime
version = strftime("%Y.%m.%d.%H.%M.%S", gmtime())
with open('python/_version.py', 'w') as f:
f.write('__version__ = "{0}"'.format(version))


def configuration(parent_package='', top_path=None):
import numpy
Expand All @@ -23,17 +36,9 @@ def configuration(parent_package='', top_path=None):
if __name__ == "__main__":
from os import getenv
from numpy.distutils.core import setup

validate = True
error_on_invalid = False
if getenv('CI') is not None:
if getenv('CI').lower() == 'true':
error_on_invalid = True

setup(name='numpy-',
configuration=configuration,
version=calculate_version(validate, error_on_invalid),
cmdclass={'build_py': build_py_copy_version},
version=version,
url='https://github.com/moble/quaternion',
author='Michael Boyle',
author_email='mob22@cornell.edu',
Expand Down

0 comments on commit b732124

Please sign in to comment.