Skip to content

Commit

Permalink
maintenance release coming
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Oct 4, 2016
1 parent 301c5d7 commit e884352
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 100 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Change History
Production
**********

:2016.1004.0: `issue #61 <https://github.com/prjemian/spec2nexus/issues/61>`_: release info from git (dropped versioneer package)
:2016.0829.0: `issue #60 <https://github.com/prjemian/spec2nexus/issues/60>`_: Add new plugin test for XPCS plugin (thanks to John Hammonds)
:2016.0615.1: `issue #57 <https://github.com/prjemian/spec2nexus/issues/57>`_: keep information from unrecognized control lines,
`issue #56 <https://github.com/prjemian/spec2nexus/issues/56>`_: add *specplot* support,
Expand Down
110 changes: 55 additions & 55 deletions src/spec2nexus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# -*- coding: iso-8859-1 -*-

'''command-line tool to convert SPEC data files to NeXus HDF5'''

#-----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: prjemian@gmail.com
# :copyright: (c) 2014-2016, Pete R. Jemian
#
# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------

__author__ = 'Pete R. Jemian'
__email__ = 'prjemian@gmail.com'
__copyright__ = '2014-2016, Pete R. Jemian'

__package_name__ = 'spec2nexus'

from _version import git_release
__version__ = u'2016.0829.0'
__release__ = git_release(__package_name__, __version__)

__license_url__ = 'http://creativecommons.org/licenses/by/4.0/deed.en_US'
__license__ = 'Creative Commons Attribution 4.0 International Public License (see LICENSE file)'
__description__ = 'Converts SPEC data files and scans into NeXus HDF5 files'
__author_name__ = __author__
__author_email__ = __email__
__url__ = u'http://spec2nexus.readthedocs.org'
#__download_url__ = u'https://github.com/prjemian/spec2nexus/tarball/' + __version__
__keywords__ = ['SPEC', 'diffraction', 'data acquisition', 'NeXus', 'HDF5', 'MatPlotLib']

__install_requires__ = ('h5py','numpy', 'MatPlotLib', )
__classifiers__ = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: Freely Distributable',
'License :: Public Domain',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development',
'Topic :: Utilities',
]
# -*- coding: iso-8859-1 -*-

'''command-line tool to convert SPEC data files to NeXus HDF5'''

#-----------------------------------------------------------------------------
# :author: Pete R. Jemian
# :email: prjemian@gmail.com
# :copyright: (c) 2014-2016, Pete R. Jemian
#
# Distributed under the terms of the Creative Commons Attribution 4.0 International Public License.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------

__author__ = 'Pete R. Jemian'
__email__ = 'prjemian@gmail.com'
__copyright__ = '2014-2016, Pete R. Jemian'

__package_name__ = 'spec2nexus'

from _version import git_release
__version__ = u'2016.1004.0'
__release__ = git_release(__package_name__, __version__)

__license_url__ = 'http://creativecommons.org/licenses/by/4.0/deed.en_US'
__license__ = 'Creative Commons Attribution 4.0 International Public License (see LICENSE file)'
__description__ = 'Converts SPEC data files and scans into NeXus HDF5 files'
__author_name__ = __author__
__author_email__ = __email__
__url__ = u'http://spec2nexus.readthedocs.org'
#__download_url__ = u'https://github.com/prjemian/spec2nexus/tarball/' + __version__
__keywords__ = ['SPEC', 'diffraction', 'data acquisition', 'NeXus', 'HDF5', 'MatPlotLib']

__install_requires__ = ('h5py','numpy', 'MatPlotLib', )
__classifiers__ = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: Freely Distributable',
'License :: Public Domain',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development',
'Topic :: Utilities',
]
52 changes: 7 additions & 45 deletions src/spec2nexus/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
'''

DEVELOPER_TEST_STRING = '__developer_testing__'
DEVELOPER_TEST_PACKAGE = '__developer_testing__'
DEVELOPER_TEST_RELEASE = 'git_release_unavailable'
GIT_COMMAND = 'git describe'

def git_release(package, version='release_undefined'):
'''
Expand All @@ -33,58 +35,18 @@ def git_release(package, version='release_undefined'):
# a valid response to the "git describe" command and return the wrong version string.
path = os.path.dirname(__file__)
dirname = os.path.split(path)[-1]
if package not in (dirname, DEVELOPER_TEST_STRING):
if package not in (dirname, DEVELOPER_TEST_PACKAGE):
raise ValueError

git_command = 'git describe'.split()
p = subprocess.Popen(git_command,
p = subprocess.Popen(GIT_COMMAND.split(),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, _err = p.communicate()
if out:
parts = out.decode().strip().split('-')
release = parts[0]
if len(parts) == 3:
release += '+' + parts[1]
release += ':' + parts[2]
elif len(parts) > 1:
msg = 'unhandled response from ' + git_command + ': ' + out.strip()
raise ValueError(msg)
release = out.decode().strip()
except Exception, _exc:
pass
return release


def get_version_strings(__version__):
'''
DEPRECATED: Determine the displayable version string, given some supplied text
:param str __version__: supplied version string, terse.
If the supplied version ends with "+", then seek more information
from git.
:param str __display_version__: version string for informative display
'''
__display_version__ = __version__ # used for command line version
if __version__.endswith('+'):
# try to find out the changeset hash if checked out from git, and append
# it to __version__ (since we use this value from setup.py, it gets
# automatically propagated to an installed copy as well)
__display_version__ = __version__
__version__ = __version__[:-1] # remove '+' for PEP-440 version spec.
try:
import os, subprocess
package_dir = os.path.abspath(os.path.dirname(__file__))
p = subprocess.Popen(['git', 'show', '-s', '--pretty=format:%h',
os.path.join(package_dir, '..')],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, _err = p.communicate()
if out:
__display_version__ += out.decode().strip()
except Exception:
pass
return __display_version__, __version__


if __name__ == '__main__':
print(git_release(DEVELOPER_TEST_STRING, 'git_release_string'))
print(git_release(DEVELOPER_TEST_PACKAGE, DEVELOPER_TEST_RELEASE))

0 comments on commit e884352

Please sign in to comment.