Return a "dunder" __version__ expression string used as a setup(version) argument or None from searching the setup.py file at `location`. For instance: setup( version=six.__version__, ... would return six.__version__ Code inspired and heavily modifi
(location)
| 2719 | |
| 2720 | |
| 2721 | def find_setup_py_dunder_version(location): |
| 2722 | """ |
| 2723 | Return a "dunder" __version__ expression string used as a setup(version) |
| 2724 | argument or None from searching the setup.py file at `location`. |
| 2725 | |
| 2726 | For instance: |
| 2727 | setup( |
| 2728 | version=six.__version__, |
| 2729 | ... |
| 2730 | would return six.__version__ |
| 2731 | |
| 2732 | Code inspired and heavily modified from: |
| 2733 | https://github.com/pyserial/pyserial/blob/d867871e6aa333014a77498b4ac96fdd1d3bf1d8/setup.py#L34 |
| 2734 | SPDX-License-Identifier: BSD-3-Clause |
| 2735 | (C) 2001-2020 Chris Liechti <cliechti@gmx.net> |
| 2736 | """ |
| 2737 | pattern = re.compile(r"^\s*version\s*=\s*(.*__version__)", re.MULTILINE) |
| 2738 | match = find_pattern(location, pattern) |
| 2739 | if TRACE: |
| 2740 | logger_debug('find_setup_py_dunder_version:', 'location:', location, 'match:', match) |
| 2741 | return match |
| 2742 | |
| 2743 | |
| 2744 | def detect_version_attribute(setup_location): |
no test coverage detected