Return a "dunder" __version__ string or None from searching the module file at `location`. Code inspired and heavily modified from: https://github.com/pyserial/pyserial/blob/d867871e6aa333014a77498b4ac96fdd1d3bf1d8/setup.py#L34 SPDX-License-Identifier: BSD-3-Clause (C) 2001
(location)
| 2692 | |
| 2693 | |
| 2694 | def find_dunder_version(location): |
| 2695 | """ |
| 2696 | Return a "dunder" __version__ string or None from searching the module file |
| 2697 | at `location`. |
| 2698 | |
| 2699 | Code inspired and heavily modified from: |
| 2700 | https://github.com/pyserial/pyserial/blob/d867871e6aa333014a77498b4ac96fdd1d3bf1d8/setup.py#L34 |
| 2701 | SPDX-License-Identifier: BSD-3-Clause |
| 2702 | (C) 2001-2020 Chris Liechti <cliechti@gmx.net> |
| 2703 | """ |
| 2704 | pattern = re.compile(r"^__version__\s*=\s*['\"]([^'\"]*)['\"]", re.MULTILINE) |
| 2705 | match = find_pattern(location, pattern) |
| 2706 | if TRACE: logger_debug('find_dunder_version:', 'location:', location, 'match:', match) |
| 2707 | return match |
| 2708 | |
| 2709 | |
| 2710 | def find_plain_version(location): |
no test coverage detected