Try to determine the version from _version.py if present.
(filename)
| 1388 | |
| 1389 | |
| 1390 | def versions_from_file(filename): |
| 1391 | """Try to determine the version from _version.py if present.""" |
| 1392 | try: |
| 1393 | with open(filename) as f: |
| 1394 | contents = f.read() |
| 1395 | except OSError: |
| 1396 | raise NotThisMethod("unable to read _version.py") |
| 1397 | mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", |
| 1398 | contents, re.M | re.S) |
| 1399 | if not mo: |
| 1400 | mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", |
| 1401 | contents, re.M | re.S) |
| 1402 | if not mo: |
| 1403 | raise NotThisMethod("no version_json in _version.py") |
| 1404 | return json.loads(mo.group(1)) |
| 1405 | |
| 1406 | |
| 1407 | def write_to_version_file(filename, versions): |
no test coverage detected
searching dependent graphs…