1######################################################################
2#  This file is part of e-antic.
3#
4#        Copyright (C) 2020 Julian Rüth
5#
6#  e-antic is free software: you can redistribute it and/or modify
7#  it under the terms of the GNU Lesser General Public License as published by
8#  the Free Software Foundation, either version 3 of the License, or (at your
9#  option) any later version.
10#
11#  e-antic is distributed in the hope that it will be useful,
12#  but WITHOUT ANY WARRANTY; without even the implied warranty of
13#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#  GNU General Public License for more details.
15#
16#  You should have received a copy of the GNU General Public License
17#  along with e-antic. If not, see <https://www.gnu.org/licenses/>.
18#####################################################################
19
20import sys
21from packaging import version
22
23from rever.activity import activity
24
25try:
26  input("Are you sure you are on the master branch which is identical to origin/master and the only pending changes are a version_info bump in configure.ac? [ENTER]")
27except KeyboardInterrupt:
28  sys.exit(1)
29
30@activity
31def dist():
32    r"""
33    Run make dist and collect the resulting tarball.
34    """
35    from tempfile import TemporaryDirectory
36    from xonsh.dirstack import DIRSTACK
37    with TemporaryDirectory() as tmp:
38        ./bootstrap
39        pushd @(tmp)
40        @(DIRSTACK[-1])/configure
41        make dist
42        mv *.tar.gz @(DIRSTACK[-1])
43        popd
44    return True
45
46$PROJECT = 'e-antic'
47
48$ACTIVITIES = [
49    'version_bump',
50    'changelog',
51    'dist',
52    'tag',
53    'push_tag',
54    'ghrelease',
55]
56
57MAJOR, MINOR, PATCH = version.parse($VERSION).release
58
59$VERSION_BUMP_PATTERNS = [
60    ('configure.ac', r'AC_INIT', r'AC_INIT([e-antic], [$VERSION], [vincent.delecroix@math.cnrs.fr])'),
61    ('libeantic/configure.ac', r'AC_INIT', r'AC_INIT([libeantic], [$VERSION], [vincent.delecroix@math.cnrs.fr])'),
62    ('libeantic/e-antic/e-antic.h.in', r'#define E_ANTIC_VERSION ', r'#define E_ANTIC_VERSION "$VERSION"'),
63    ('libeantic/e-antic/e-antic.h.in', r'#define E_ANTIC_VERSION_MAJOR', rf'#define E_ANTIC_VERSION_MAJOR {MAJOR}'),
64    ('libeantic/e-antic/e-antic.h.in', r'#define E_ANTIC_VERSION_MINOR', rf'#define E_ANTIC_VERSION_MINOR {MINOR}'),
65    ('libeantic/e-antic/e-antic.h.in', r'#define E_ANTIC_VERSION_PATCHLEVEL', rf'#define E_ANTIC_VERSION_PATCHLEVEL {PATCH}'),
66    ('libeantic/recipe/meta.yaml', r"\{% set version =", r"{% set version = '$VERSION' %}"),
67    ('libeantic/recipe/meta.yaml', r"\{% set build_number =", r"{% set build_number = '0' %}"),
68    ('pyeantic/configure.ac', r'AC_INIT', r'AC_INIT([pyeantic], [$VERSION], [julian.rueth@fsfe.org])'),
69    ('pyeantic/recipe/meta.yaml', r"\{% set version =", r"{% set version = '$VERSION' %}"),
70    ('pyeantic/recipe/meta.yaml', r"\{% set build_number =", r"{% set build_number = '0' %}"),
71]
72
73$CHANGELOG_FILENAME = 'ChangeLog'
74$CHANGELOG_TEMPLATE = 'TEMPLATE.rst'
75$CHANGELOG_NEWS = 'doc/news'
76$CHANGELOG_CATEGORIES = ('Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Performance')
77$PUSH_TAG_REMOTE = 'git@github.com:flatsurf/e-antic.git'
78
79$GITHUB_ORG = 'flatsurf'
80$GITHUB_REPO = 'e-antic'
81
82$GHRELEASE_ASSETS = ['e-antic-' + $VERSION + '.tar.gz']
83