|
1 | 1 | #!/usr/bin/env python |
2 | 2 | ############################################################################## |
3 | 3 | # |
4 | | -# diffpy.srfit by DANSE Diffraction group |
5 | | -# Simon J. L. Billinge |
6 | | -# (c) 2008 The Trustees of Columbia University |
7 | | -# in the City of New York. All rights reserved. |
| 4 | +# (c) 2008-2025 The Trustees of Columbia University in the City of New York. |
| 5 | +# All rights reserved. |
8 | 6 | # |
9 | | -# File coded by: Chris Farrow |
| 7 | +# File coded by: Christopher Farrow, Pavol Juhas, and members of the Billinge Group. |
10 | 8 | # |
11 | | -# See AUTHORS.txt for a list of people who contributed. |
12 | | -# See LICENSE_DANSE.txt for license information. |
| 9 | +# See GitHub contributions for a more detailed list of contributors. |
| 10 | +# https://github.com/diffpy/diffpy.srfit/graphs/contributors |
| 11 | +# |
| 12 | +# See LICENSE.rst for license information. |
13 | 13 | # |
14 | 14 | ############################################################################## |
| 15 | +"""Definition of __version__.""" |
15 | 16 |
|
16 | | -"""Definition of __version__, __date__, __timestamp__, __git_commit__. |
17 | | -
|
18 | | -Notes |
19 | | ------ |
20 | | -Variable `__gitsha__` is deprecated as of version 3.0. |
21 | | -Use `__git_commit__` instead. |
22 | | -""" |
23 | | - |
24 | | -__all__ = ['__date__', '__git_commit__', '__timestamp__', '__version__'] |
25 | | - |
26 | | -import os.path |
27 | | - |
28 | | -from pkg_resources import resource_filename |
29 | | - |
30 | | - |
31 | | -# obtain version information from the version.cfg file |
32 | | -cp = dict(version='', date='', commit='', timestamp='0') |
33 | | -fcfg = resource_filename(__name__, 'version.cfg') |
34 | | -if not os.path.isfile(fcfg): # pragma: no cover |
35 | | - from warnings import warn |
36 | | - warn('Package metadata not found, execute "./setup.py egg_info".') |
37 | | - fcfg = os.devnull |
38 | | -with open(fcfg) as fp: |
39 | | - kwords = [[w.strip() for w in line.split(' = ', 1)] |
40 | | - for line in fp if line[:1].isalpha() and ' = ' in line] |
41 | | -assert all(w[0] in cp for w in kwords), "received unrecognized keyword" |
42 | | -cp.update(kwords) |
43 | | - |
44 | | -__version__ = cp['version'] |
45 | | -__date__ = cp['date'] |
46 | | -__git_commit__ = cp['commit'] |
47 | | -__timestamp__ = int(cp['timestamp']) |
| 17 | +# We do not use the other three variables, but can be added back if needed. |
| 18 | +# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] |
48 | 19 |
|
49 | | -# TODO remove deprecated __gitsha__ in version 3.1. |
50 | | -__gitsha__ = __git_commit__ |
| 20 | +# obtain version information |
| 21 | +from importlib.metadata import version |
51 | 22 |
|
52 | | -del cp, fcfg, fp, kwords |
| 23 | +__version__ = version("diffpy.srfit") |
53 | 24 |
|
54 | 25 | # End of file |
0 commit comments