Try to determine the version from _version.py if present.
(filename)
| 1401 | |
| 1402 | |
| 1403 | def versions_from_file(filename): |
| 1404 | """Try to determine the version from _version.py if present.""" |
| 1405 | try: |
| 1406 | with open(filename) as f: |
| 1407 | contents = f.read() |
| 1408 | except OSError: |
| 1409 | raise NotThisMethod("unable to read _version.py") |
| 1410 | mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) |
| 1411 | if not mo: |
| 1412 | mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) |
| 1413 | if not mo: |
| 1414 | raise NotThisMethod("no version_json in _version.py") |
| 1415 | return json.loads(mo.group(1)) |
| 1416 | |
| 1417 | |
| 1418 | def write_to_version_file(filename, versions): |
no test coverage detected
searching dependent graphs…