|
1 | 1 | #!/usr/bin/env python |
2 | 2 | ############################################################################## |
3 | 3 | # |
4 | | -# diffpy.srreal 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) 2025 The Trustees of Columbia University in the City of New York. |
| 5 | +# All rights reserved. |
8 | 6 | # |
9 | | -# File coded by: Pavol Juhas |
| 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.srreal/graphs/contributors |
| 11 | +# |
| 12 | +# See LICENSE.rst for license information. |
13 | 13 | # |
14 | 14 | ############################################################################## |
15 | | -"""Definitions of version-related constants and of libdiffpy_version_info. |
16 | | -
|
17 | | -Notes |
18 | | ------ |
19 | | -Variable `__gitsha__` is deprecated as of version 1.3. |
20 | | -Use `__git_commit__` instead. |
21 | | -
|
22 | | -Variable `libdiffpy_version_info.git_sha` is deprecated as of version 1.4.0. |
23 | | -Use `libdiffpy_version_info.git_commit` instead. |
24 | | -""" |
25 | | - |
26 | | -__all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__", "libdiffpy_version_info"] |
27 | | - |
28 | | - |
29 | | -from diffpy.srreal._version_data import __date__, __git_commit__, __timestamp__, __version__ |
30 | | - |
31 | | -# TODO remove deprecated __gitsha__ in version 1.4. |
32 | | -__gitsha__ = __git_commit__ |
33 | | - |
34 | | -# version information on the active libdiffpy shared library ----------------- |
| 15 | +"""Definition of __version__.""" |
35 | 16 |
|
36 | | -from collections import namedtuple |
| 17 | +# We do not use the other three variables, but can be added back if needed. |
| 18 | +# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] |
37 | 19 |
|
38 | | -from diffpy.srreal.srreal_ext import _get_libdiffpy_version_info_dict |
| 20 | +# obtain version information |
| 21 | +from importlib.metadata import version |
39 | 22 |
|
40 | | -libdiffpy_version_info = namedtuple( |
41 | | - "libdiffpy_version_info", |
42 | | - "major minor micro patch version_number version date git_commit " + |
43 | | - # TODO remove git_sha in version 1.4. |
44 | | - "git_sha", |
45 | | -) |
46 | | -vd = _get_libdiffpy_version_info_dict() |
47 | | -libdiffpy_version_info = libdiffpy_version_info( |
48 | | - version=vd["version_str"], |
49 | | - version_number=vd["version"], |
50 | | - major=vd["major"], |
51 | | - minor=vd["minor"], |
52 | | - micro=vd["micro"], |
53 | | - patch=vd["patch"], |
54 | | - date=vd["date"], |
55 | | - git_commit=vd["git_commit"], |
56 | | - # TODO remove git_sha in version 1.4. |
57 | | - git_sha=vd["git_commit"], |
58 | | -) |
59 | | -del vd |
| 23 | +__version__ = version("diffpy.srreal") |
60 | 24 |
|
61 | 25 | # End of file |
0 commit comments