|
14 | 14 | # import sys
|
15 | 15 | # sys.path.insert(0, os.path.abspath('.'))
|
16 | 16 |
|
| 17 | +import re |
| 18 | +import sys |
17 | 19 |
|
18 | 20 | # -- Project information -----------------------------------------------------
|
19 | 21 |
|
20 | 22 | project = 'haskell-language-server'
|
21 |
| -copyright = '2021, The Haskell IDE Team' |
22 |
| -author = 'The Haskell IDE Team' |
23 | 23 |
|
24 |
| -# The full version, including alpha/beta/rc tags |
25 |
| -release = '1.3.0' |
| 24 | +# We want to take some of the metadata from the Cabal file, especially the version. |
| 25 | +# (otherwise it's very easy to forget to update it!) |
| 26 | +release = None |
| 27 | +copyright = None |
| 28 | +author = None |
| 29 | +versionPattern = re.compile("^version:\s*([\d.]+)") |
| 30 | +copyrightPattern = re.compile("^copyright:\s*(.+)") |
| 31 | +authorPattern = re.compile("^author:\s*(.+)") |
| 32 | +for i, line in enumerate(open('../haskell-language-server.cabal')): |
| 33 | + versionMatch = re.search(versionPattern, line) |
| 34 | + if versionMatch: |
| 35 | + release = versionMatch.group(1) |
| 36 | + copyrightMatch = re.search(copyrightPattern, line) |
| 37 | + if copyrightMatch: |
| 38 | + copyright = copyrightMatch.group(1) |
| 39 | + authorMatch = re.search(authorPattern, line) |
| 40 | + if authorMatch: |
| 41 | + author = authorMatch.group(1) |
26 | 42 |
|
| 43 | +if not release: |
| 44 | + print("Couldn't find version") |
| 45 | + sys.exit() |
| 46 | +if not copyright: |
| 47 | + print("Couldn't find copyright") |
| 48 | + sys.exit() |
| 49 | +if not author: |
| 50 | + print("Couldn't find author") |
| 51 | + sys.exit() |
27 | 52 |
|
28 | 53 | # -- General configuration ---------------------------------------------------
|
29 | 54 |
|
|
0 commit comments