|
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) 2024 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: Billinge Group members and community contributors. |
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 | 15 |
|
16 |
| -""" |
17 |
| -Definition of __version__, __date__, __timestamp__, __git_commit__. |
18 |
| -
|
19 |
| -Notes |
20 |
| ------ |
21 |
| -Variable `__gitsha__` is deprecated as of version 3.0. |
22 |
| -Use `__git_commit__` instead. |
23 |
| -""" |
24 |
| - |
25 |
| -__all__ = ['__date__', '__git_commit__', '__timestamp__', '__version__'] |
26 |
| - |
27 |
| -import os.path |
28 |
| - |
29 |
| -from pkg_resources import resource_filename |
30 |
| - |
31 |
| - |
32 |
| -# obtain version information from the version.cfg file |
33 |
| -cp = dict(version='', date='', commit='', timestamp='0') |
34 |
| -fcfg = resource_filename(__name__, 'version.cfg') |
35 |
| -if not os.path.isfile(fcfg): # pragma: no cover |
36 |
| - from warnings import warn |
37 |
| - warn('Package metadata not found, execute "./setup.py egg_info".') |
38 |
| - fcfg = os.devnull |
39 |
| -with open(fcfg) as fp: |
40 |
| - kwords = [[w.strip() for w in line.split(' = ', 1)] |
41 |
| - for line in fp if line[:1].isalpha() and ' = ' in line] |
42 |
| -assert all(w[0] in cp for w in kwords), "received unrecognized keyword" |
43 |
| -cp.update(kwords) |
| 16 | +"""Definition of __version__.""" |
44 | 17 |
|
45 |
| -__version__ = cp['version'] |
46 |
| -__date__ = cp['date'] |
47 |
| -__git_commit__ = cp['commit'] |
48 |
| -__timestamp__ = int(cp['timestamp']) |
| 18 | +# We do not use the other three variables, but can be added back if needed. |
| 19 | +# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] |
49 | 20 |
|
50 |
| -# TODO remove deprecated __gitsha__ in version 3.1. |
51 |
| -__gitsha__ = __git_commit__ |
| 21 | +# obtain version information |
| 22 | +from importlib.metadata import version |
52 | 23 |
|
53 |
| -del cp, fcfg, fp, kwords |
| 24 | +__version__ = version("diffpy.srfit") |
54 | 25 |
|
55 | 26 | # End of file
|
0 commit comments