branch: elpa/flycheck
commit 311cbb420622d4204d4b518ded00eeed0e19123c
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Remove obsolete maint/ directory and references
The maint/ scripts date from the Cask era and are no longer used:
- release.py: uses Cask, GitPython, old version scheme, references Gitter
- flycheck-compile.el: superseded by Eask compilation
- flycheck-checkdoc.el: superseded by `eask lint checkdoc`
- flycheck-format.el: depends on Cask-based flycheck-maint.el
- lint-python.yml: CI workflow that only linted these dead scripts
Also update the Makefile (remove format/check-format targets) and
the maintainer's guide (remove maint scripts section, modernize
release process, remove Gitter references).
---
.github/workflows/lint-python.yml | 31 ------
Makefile | 13 +--
doc/contributor/maintaining.rst | 72 +++----------
maint/Makefile | 59 -----------
maint/flycheck-checkdoc.el | 88 ----------------
maint/flycheck-compile.el | 76 --------------
maint/flycheck-format.el | 151 ---------------------------
maint/flycheck-maint.el | 57 -----------
maint/release.py | 207 --------------------------------------
maint/requirements.txt | 14 ---
10 files changed, 14 insertions(+), 754 deletions(-)
diff --git a/.github/workflows/lint-python.yml
b/.github/workflows/lint-python.yml
deleted file mode 100644
index e3f0ffe09f..0000000000
--- a/.github/workflows/lint-python.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-name: Lint Python
-
-on:
- push:
- branches:
- - master
- paths:
- - '**.yml'
- - docs/**
- pull_request:
- workflow_dispatch:
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-
-jobs:
- lint-python:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
-
- - uses: actions/setup-python@v4
- with:
- python-version: '3.10'
-
- - name: Run tests
- run: |
- pip install -r maint/requirements.txt
- make -C maint check
diff --git a/Makefile b/Makefile
index e020f92f74..bbdf4c7656 100644
--- a/Makefile
+++ b/Makefile
@@ -87,20 +87,12 @@ clean:
purge:
$(GIT) clean -xfd
-.PHONY: format
-format:
- $(RUNEMACS) -l maint/flycheck-format.el -f flycheck/batch-format
-
-.PHONY: check-format
-check-format:
- $(RUNEMACS) -l maint/flycheck-format.el -f flycheck/batch-check-format
-
.PHONY: checkdoc
checkdoc:
$(EASK) lint checkdoc
.PHONY: check
-check: check-format checkdoc
+check: checkdoc
.PHONY: compile
compile:
@@ -119,9 +111,8 @@ help:
@echo ''
@echo 'Available targets:'
@echo ' init: Initialise the project. RUN FIRST!'
- @echo ' check: Check all Emacs Lisp sources (needs Emacs 25)'
+ @echo ' check: Check all Emacs Lisp sources'
@echo ' compile: Byte-compile Emacs Lisp sources'
- @echo ' format: Format all Emacs Lisp sources'
@echo ' specs: Run all buttercup specs for Flycheck'
@echo ' images: Generate PNG images from SVG sources'
@echo ' clean: Clean compiled files'
diff --git a/doc/contributor/maintaining.rst b/doc/contributor/maintaining.rst
index b8d044f375..6ef7027cc6 100644
--- a/doc/contributor/maintaining.rst
+++ b/doc/contributor/maintaining.rst
@@ -201,28 +201,6 @@ these services so in case of an issue just contact them.
.. _CLA assistant: https://cla-assistant.io
.. _CLA: https://gist.github.com/swsnr/c9c0d656fe7e704da2f734779242ec99
-.. _flycheck-maintenance-scripts:
-
-Maintenance scripts
-===================
-
-Administrative processes are tedious and time-consuming, so we try to automate
-as much as possible. The :file:`maint/` directory contains many scripts for
-this purpose. ``make -C maint/ help`` provides an overview over all
-administrative tasks.
-
-Most of these scripts require Python 3.5 and additional Python libraries. On
OS
-X it is recommended that you use Homebrew_ to install the latest Python version
-with ``brew install python3``. On Linux you should be able to obtain Python
3.5
-from the package manager of your distribution.
-
-To install all required libraries run ``make -C maint init``. We recommend
that
-you use virtualenv_ to avoid a global installation of Python modules. ``make
-init`` will warn you if you do not.
-
-.. _Homebrew: https://brew.sh
-.. _virtualenv: https://virtualenv.pypa.io/en/latest/
-
Versioning and releases
=======================
@@ -256,37 +234,16 @@ First, check that
3. all commits are pushed,
4. and CI passes for the latest commit on ``master``.
-If all is good a new release is as simple as
-
-.. code-block:: console
-
- $ make -C maint release
-
-This runs the release script in :file:`maint/release.py`. If any of the above
-requirements isn't met the release script will signal an error and abort.
+To make a release:
-The release script bumps the version number, commits and tags a new release,
and
-pushes it to Github.
-
-.. note::
-
- The tag is *signed*; you must configure Git for :ref:`signing commits and
- tags <flycheck-git-signatures>` before you make a release the first time.
- After pushing the new release to Github, the script bumps the version
number
- again, to the next snapshot, and commits the changes again.
-
-Once the script is completed please
-
-1. Edit the `release information`_ on Github and add a short summary about the
- release. Don’t forget to add a link to the complete changelog and upload
the
- package TAR file.
-2. Enable the new release on the ReadTheDocs `versions dashboard`_.
-3. Announce the new release in our Gitter_ channel, and wherever else you see
- fit.
-
-.. _release information: https://github.com/flycheck/flycheck/releases
-.. _versions dashboard: https://readthedocs.org/dashboard/flycheck/versions/
-.. _Gitter: https://gitter.im/flycheck/flycheck
+1. Update the ``Version:`` header in ``flycheck.el`` and the version in
+ ``Eask``.
+2. Update ``CHANGES.rst``: replace the ``master (unreleased)`` header with the
+ version and date, and add a fresh unreleased section above it.
+3. Commit the changes with a message like ``Release X.Y``.
+4. Tag the commit (e.g. ``git tag vX.Y``).
+5. Push the commit and tag to GitHub.
+6. Create a GitHub release from the tag using ``gh release create``.
New maintainers
===============
@@ -296,11 +253,6 @@ To propose a new maintainer open a pull request that adds
the user to
to the :ref:`same rules <flycheck-pull-requests-reviews>` as all other pull
requests. Notably it goes through the same approval process.
-Once merged please also
-
-- add the new maintainer to the ``Maintainers`` team of the Github
- organisation. This does not award additional privileges, it's just to
support
- ``@flycheck/maintainers`` mentions for the sake of convenience,
-- invite the new maintainer to the internal `Maintainers channel`_ on Gitter,
-
-.. _Maintainers channel: https://gitter.im/flycheck/maintainers
+Once merged please also add the new maintainer to the ``Maintainers`` team of
+the Github organisation. This does not award additional privileges, it's just
+to support ``@flycheck/maintainers`` mentions for the sake of convenience.
diff --git a/maint/Makefile b/maint/Makefile
deleted file mode 100644
index ba06e5d337..0000000000
--- a/maint/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (c) 2012-2016 Sebastian Wiesner and Flycheck contributors
-
-# This program is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation, either version 3 of the License, or (at your option) any later
-# version.
-
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-
-# You should have received a copy of the GNU General Public License along with
-# this program. If not, see <http://www.gnu.org/licenses/>.
-
-PYTHON = python3
-FLAKE8 = flake8
-PIP = pip3
-HAVE_PIP := $(shell sh -c "command -v $(PIP)")
-
-.DEFAULT_GOAL := help
-
-.PHONY: init
-init:
-ifndef HAVE_PIP
- $(error "$(PIP) not available. Please run make help.")
-endif
-ifndef VIRTUAL_ENV
- $(warning "No virtualenv active. Installing globally is not
recommended.")
-ifndef FORCE
- $(error "Aborted. Run make FORCE=1 init to override or make help.")
-endif
-endif
- pip install -r requirements.txt
-
-.PHONY: help
-help:
- @echo 'Available targets:'
- @echo ' init: Install dependencies of maintenance scripts'
- @echo ' check: Check maintenance scripts'
- @echo ' release: Make a Flycheck release'
- @echo ''
- @echo 'You need Python 3.5 for all maintenance scripts'
- @echo ''
- @echo 'Run make init to install required libraries. It is recommended'
- @echo 'that you use virtualenv (https://virtualenv.pypa.io/en/latest/)'
- @echo 'to avoid a global installation of Python packages. make init'
- @echo 'will warn you if you do not.'
-
-.PHONY: release
-release:
- @./release.py
-
-.PHONY: lint
-lint:
- $(FLAKE8) ..
-
-.PHONY: check
-check: lint
diff --git a/maint/flycheck-checkdoc.el b/maint/flycheck-checkdoc.el
deleted file mode 100644
index ec74570d34..0000000000
--- a/maint/flycheck-checkdoc.el
+++ /dev/null
@@ -1,88 +0,0 @@
-;;; flycheck-checkdoc.el --- Flycheck: Checkdoc runner -*- lexical-binding:
t; -*-
-
-;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors
-
-;; Author: Sebastian Wiesner <[email protected]>
-;; This file is not part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file provides checkdoc linting for Flycheck. It's intended for
-;; non-interactive use, see "make checkdoc".
-
-;;; Code:
-
-(unless (version<= "25" emacs-version)
- (user-error "Emacs 25 required for checkdoc"))
-
-(require 'subr-x)
-(require 'seq)
-(require 'f)
-(require 'checkdoc)
-(require 'flycheck-maint
- (expand-file-name "flycheck-maint"
- (file-name-directory (f-this-file))))
-
-(defconst flycheck/source-dir (locate-dominating-file load-file-name "Cask")
- "The source directory of Flycheck.")
-
-(defun flycheck/checkdoc-get-current-errors ()
- "Get the current checkdoc errors.
-
-Return a list of all error messages from checkdoc, and erase the
-error message buffer, so that the next checkdoc check starts
-fresh without previous errors.
-
-Each error is just a string with the complete human-readable
-location and error message."
- (with-current-buffer checkdoc-diagnostic-buffer
- (unwind-protect
- (progn
- (goto-char (point-min))
- ;; Skip over the checkdoc header
- (re-search-forward (rx line-start "***" (1+ not-newline)
- ": checkdoc-current-buffer"))
- (forward-line 1)
- (let ((text (buffer-substring-no-properties (point) (point-max))))
- (and (not (string-empty-p text))
- (split-string text "\n"))))
- (kill-buffer))))
-
-(defun flycheck/checkdoc-file (filename)
- "Run checkdoc on FILENAME and return a list of errors.
-
-Each error is just a string with the complete human-readable
-location and error message."
- (with-temp-buffer
- ;; Visit the file to make sure that the filename is set, as some checkdoc
- ;; lints only apply for buffers with filenames
- (insert-file-contents filename 'visit)
- (set-buffer-modified-p nil)
- ;; Switch to Emacs Lisp mode to give checkdoc the proper syntax table, etc.
- (delay-mode-hooks (emacs-lisp-mode))
- (setq delay-mode-hooks nil)
- (let ((checkdoc-arguments-in-order-flag nil))
- (checkdoc-current-buffer 'take-notes))
- (flycheck/checkdoc-get-current-errors)))
-
-(defun flycheck/batch-checkdoc ()
- "Run checkdoc on all source files and exit."
- (let ((errors (seq-mapcat #'flycheck/checkdoc-file
- (flycheck/all-source-files))))
- (seq-do (lambda (err) (message "%s" err)) errors)
- (kill-emacs (if errors 1 0))))
-
-;;; flycheck-checkdoc.el ends here
diff --git a/maint/flycheck-compile.el b/maint/flycheck-compile.el
deleted file mode 100644
index 37b839a78b..0000000000
--- a/maint/flycheck-compile.el
+++ /dev/null
@@ -1,76 +0,0 @@
-;;; flycheck-compile.el --- Flycheck byte compiler -*-
lexical-binding: t; -*-
-
-;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors
-
-;; Author: Sebastian Wiesner <[email protected]>
-;; This file is not part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file provides non-interactive byte compilation for Flycheck.
-;;
-;; It's essentially a wrapper around `batch-byte-compile' which sets some
-;; additional byte compiler options for Flycheck.
-
-;;; Code:
-
-(require 'warnings)
-(require 'bytecomp)
-
-(unless noninteractive
- (error "This file must not be used interactively"))
-
-(defun flycheck/batch-byte-compile ()
- "Like `batch-byte-compile', but set additional flags.
-
-Specifically set `byte-compile-error-on-warn' to t on Emacs 25."
- ;; Unfortunately `byte-compile-error-on-warn' does not quite what the name
- ;; suggest because for whatever mysterious reason there's also
- ;; `byte-compile-log-warning' used throughout Emacs' code which bypasses
- ;; `byte-compile-error-on-warn' and instead logs an Emacs warning with
- ;; `display-warning'. These warnings don't trigger errors even if
- ;; `byte-compile-error-on-warn' is non-nil, which is… well, at least a very
- ;; _unusual_ design decision, which leads the whole purpose of
- ;; `byte-compile-error-on-warn' ad absurdum.
- ;;
- ;; To work around this mess (I'm sorry) we check the size of
- ;; `byte-compile-log-buffer' after each file to check if any warnings end up
- ;; there and exit with a non-zero code if the buffer is not empty.
- ;;
- ;; Unfortunately this means that we can't use `batch-byte-compile' (which is
- ;; the proper API) and instead have to call the undocumented internal
function
- ;; `batch-byte-compile-file'. Yay, so now proper byte compilation of
Flycheck
- ;; depends on Emacs' internals, and much evil is accomplished. Can't get any
- ;; worse, can it?
- (let ((byte-compile-error-on-warn (version<= "25" emacs-version)))
- (while command-line-args-left
- (let ((filename (pop command-line-args-left)))
- (unless (batch-byte-compile-file filename)
- ;; Exit if compilation failed
- (kill-emacs 1))
- (when (and byte-compile-error-on-warn
- (get-buffer byte-compile-log-buffer)
- (> (buffer-size (get-buffer byte-compile-log-buffer)) 0))
- ;; If there's anything in the log buffer (from the idiocy that is
- ;; `byte-compile-log-warning') exit as well to _ALL_ warnings, really
- ;; ALL WARNINGS. Got it, Emacs? Why are making my life so hard? At
- ;; least we don't have to print the contents explicitly because
- ;; `display-warnings' writes to standard whatever stream in batch
- ;; mode.
- (kill-emacs 1)))))
- (kill-emacs 0))
-
-;;; flycheck-compile.el ends here
diff --git a/maint/flycheck-format.el b/maint/flycheck-format.el
deleted file mode 100644
index f954475e52..0000000000
--- a/maint/flycheck-format.el
+++ /dev/null
@@ -1,151 +0,0 @@
-;;; flycheck-format.el --- Flycheck: Source code formatter -*-
lexical-binding: t; -*-
-
-;; Copyright (C) 2016, 2018 Sebastian Wiesner and Flycheck contributors
-
-;; Author: Sebastian Wiesner <[email protected]>
-;; This file is not part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file provides source code formatting for Flycheck. It's mainly
intended
-;; for non-interactive use, see "make format".
-
-;;; Code:
-
-(unless (version<= "25" emacs-version)
- (user-error "Emacs 25 required for formatting"))
-
-(require 'seq)
-(require 'rx)
-(require 'f)
-(require 'whitespace)
-(require 'elisp-mode)
-
-;; Work around Emacs bug #39761
-(require 'cl-lib)
-
-(require 'flycheck-maint
- (expand-file-name "flycheck-maint"
- (file-name-directory (f-this-file))))
-
-(defun flycheck/eval-and-format-buffer (filename)
- "Format the current buffer for FILENAME.
-
-THIS FUNCTION HAS GLOBAL AND LOCAL SIDE EFFECTS.
-
-Evaluate the buffer to make all special indentation rules of
-local definitions available before formatting.
-
-Switch the buffer to Emacs Lisp mode."
- (let (delayed-mode-hooks)
- (delay-mode-hooks (emacs-lisp-mode)))
- ;; Load the file to make indentation rules from local definitions available.
- ;; We load files instead of evaluating them because some files in our code
- ;; rely on `load-file-name' and similar stuff. Don't load files which are
- ;; already loaded, though, to prevent a recursive load of this file.
- (unless (flycheck/already-loaded-p filename)
- (let ((load-prefer-newer t)) ; Silence "newer" messages
- (load filename 'noerror 'nomessage 'nosuffix)))
- (widen)
- (let ((indent-tabs-mode nil)
- (whitespace-style
- '(empty ; Cleanup empty lines at end
- indentation::space ; Replace tabs with spaces
- space-before-tab::space ; Replace tabs with spaces
- trailing ; Remove trailing spaces
- )))
- (let ((inhibit-message t))
- ;; Silence "Indenting region..." progress reporter
- (indent-region (point-min) (point-max)))
- (whitespace-cleanup-region (point-min) (point-max))))
-
-(defun flycheck/check-long-lines (filename &optional length)
- "Check FILENAME for lines longer than LENGTH.
-
-Display a message for any line longer than LENGTH. If LENGTH is
-nil, default to `fill-column'. Return t if FILENAME has no long
-lines, otherwise return nil.
-
-If FILENAME is a package file, return t regardless if there are
-long lines or not."
- (let ((long-lines 0)
- (max-length (or length fill-column)))
- (save-excursion
- (goto-char (point-min))
- ;; If the file has a Commentary line, then it's a package and we start
- ;; checking for long lines after the Commentary section. Lines before it
- ;; may be too long but some are unsplittable.
- (when (search-forward ";;; Commentary:" nil t)
- (while (not (eobp))
- (end-of-line)
- (when (> (current-column) max-length)
- (message "%s:%d: line is over %d characters"
- filename
- (line-number-at-pos (point))
- max-length)
- (setq long-lines (1+ long-lines)))
- (forward-line 1))))
- (= long-lines 0)))
-
-(defun flycheck/can-have-long-lines (filename)
- "Whether FILENAME can have arbitrarily long lines.
-
-Test files which contain error messages from checkers are allowed
-to have long lines."
- (string-match-p (rx "languages/test-") filename))
-
-(defun flycheck/file-formatted-p (filename)
- "Check whether FILENAME is properly formatted.
-
-Return a non-nil value in this case, otherwise return nil."
- (with-temp-buffer
- (insert-file-contents filename)
- (set-buffer-modified-p nil)
- (flycheck/eval-and-format-buffer filename)
- (and (not (buffer-modified-p))
- (or (flycheck/can-have-long-lines filename)
- (flycheck/check-long-lines filename 80)))))
-
-(defun flycheck/batch-check-format ()
- "Check formatting of all sources."
- (let ((bad-files (seq-remove #'flycheck/file-formatted-p
- (flycheck/all-source-files))))
- (if (null bad-files)
- (kill-emacs 0)
- (seq-do (lambda (filename) (message "%s: misformatted!" filename))
- bad-files)
- (kill-emacs 1))))
-
-(defun flycheck/format-file (filename)
- "Format FILENAME.
-
-Return a non-nil value if the file was formatted, and nil
-otherwise."
- (with-temp-file filename
- (insert-file-contents filename)
- (set-buffer-modified-p nil)
- (flycheck/eval-and-format-buffer filename)
- (buffer-modified-p)))
-
-(defun flycheck/batch-format ()
- "Format all Flycheck source files."
- (let ((formatted-files (seq-filter #'flycheck/format-file
- (flycheck/all-source-files))))
- (seq-do (lambda (filename) (message "Formatted %s" filename))
- formatted-files)
- (kill-emacs 0)))
-
-;;; flycheck-format.el ends here
diff --git a/maint/flycheck-maint.el b/maint/flycheck-maint.el
deleted file mode 100644
index f0f7979916..0000000000
--- a/maint/flycheck-maint.el
+++ /dev/null
@@ -1,57 +0,0 @@
-;;; flycheck-maint.el --- Flycheck: Maintenance library -*- lexical-binding:
t; -*-
-
-;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors
-
-;; Author: Sebastian Wiesner <[email protected]>
-;; This file is not part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file provides helper functions for maintenance tools.
-
-;;; Code:
-
-(unless noninteractive
- (error "This file must not be used interactively"))
-
-(defconst flycheck/source-dir (locate-dominating-file load-file-name "Cask")
- "The source directory of Flycheck.")
-
-(defun flycheck/collect-el-files (directory &optional recursive)
- "Collect all Emacs Lisp files in DIRECTORY.
-
-If RECURSIVE is given and non-nil collect files recursively."
- (let ((fn-re (rx ".el" eos)))
- (if recursive
- (directory-files-recursively directory fn-re)
- (directory-files directory 'full fn-re))))
-
-(defun flycheck/all-source-files ()
- "Find all source files of Flycheck."
- (append
- (seq-mapcat (lambda (rel-name)
- (flycheck/collect-el-files
- (expand-file-name rel-name flycheck/source-dir)))
- '("." "maint/" "doc/" "test/"))
- (flycheck/collect-el-files
- (expand-file-name "test/specs/" flycheck/source-dir) 'recursive)))
-
-(defun flycheck/already-loaded-p (filename)
- "Whether FILENAME is already loaded."
- (not (null (assoc filename load-history))))
-
-(provide 'flycheck-maint)
-;;; flycheck-maint.el ends here
diff --git a/maint/release.py b/maint/release.py
deleted file mode 100755
index 1aa0e24199..0000000000
--- a/maint/release.py
+++ /dev/null
@@ -1,207 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (C) 2017 Flycheck contributors
-# Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors
-
-# This file is not part of GNU Emacs.
-
-# This program is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation, either version 3 of the License, or (at your option) any later
-# version.
-
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-
-# You should have received a copy of the GNU General Public License along with
-# this program. If not, see <http://www.gnu.org/licenses/>.
-
-import re
-import sys
-import subprocess
-from datetime import date
-from collections import namedtuple
-from pathlib import Path
-
-import requests
-from git import Repo
-
-
-SOURCE_DIR = Path(__file__).resolve().parent.parent
-FLYCHECK_EL = SOURCE_DIR.joinpath('flycheck.el')
-CHANGELOG = SOURCE_DIR.joinpath('CHANGES.rst')
-
-GITHUB_API = 'https://api.github.com/repos/flycheck/flycheck'
-
-VERSION_HEADER_RE = re.compile(
- r'^(?P<label>;;\s*Version:\s*)(?P<value>\S+)\s*$',
- re.MULTILINE)
-
-
-class CannotReleaseError(Exception):
- pass
-
-
-class Version(namedtuple('Version', 'version is_snapshot')):
-
- RE = re.compile(r'^(?P<version>\d+)(?:(?P<snapshot>-cvs))?$')
-
- @classmethod
- def fromstring(cls, s):
- match = cls.RE.match(s)
- if not match:
- raise ValueError('Not a version: {}'.format(s))
- return cls(version=int(match.group('version')),
- is_snapshot=match.group('snapshot') is not None)
-
- def __str__(self):
- if self.is_snapshot:
- return '{}-cvs'.format(self.version)
- else:
- return str(self.version)
-
- @property
- def is_released(self):
- return not self.is_snapshot
-
- def bump(self):
- if self.is_snapshot:
- # If snapshot, then bump to release version by dropping the
- # snapshot indicator
- return self._replace(is_snapshot=False)
- else:
- # If release bump to the next snapshot version
- return self._replace(version=self.version + 1, is_snapshot=True)
-
-
-class BuildState(namedtuple('BuildState', 'commit state')):
-
- @classmethod
- def get_from_github_actions(cls):
- response = requests.get(
- GITHUB_API + '/actions/runs',
- params={'branch': 'master', 'per_page': 1},
- headers={'Accept': 'application/vnd.github+json'}).json()
- if not response.get('workflow_runs'):
- return cls(commit=None, state='unknown')
- run = response['workflow_runs'][0]
- # Map GitHub Actions conclusion to a simple state
- conclusion = run.get('conclusion', run.get('status', 'unknown'))
- state = 'passed' if conclusion == 'success' else conclusion
- return cls(commit=run['head_sha'], state=state)
-
-
-def read_version_from_library_header(path):
- contents = path.read_text()
- match = VERSION_HEADER_RE.search(contents)
- if match:
- return Version.fromstring(match.group('value'))
- else:
- raise ValueError('Could not find version header in {}'.format(path))
-
-
-def set_version_in_library_header(path, version):
- contents = path.read_text()
- path.write_text(VERSION_HEADER_RE.sub(
- r'\g<label>{}'.format(version), contents))
-
-
-def finalise_relase_in_changelog(path, version, date):
- lines = path.read_text().splitlines()
- if not lines[0].endswith(' (in development)'):
- raise ValueError('Failed to find snapshot header in {}'.format(path))
- new_header = '{} ({})'.format(version, date.strftime('%b %d, %Y'))
- header_underline = '=' * len(new_header)
- path.write_text(
- '\n'.join([new_header, header_underline] + lines[2:]) + '\n')
-
-
-def add_snapshot_to_changelog(path, version):
- header = '{} (in development)'.format(version)
- contents = path.read_text()
- underline = '=' * len(header)
- path.write_text('{}\n{}\n\n{}'.format(header, underline, contents))
-
-
-def commit_and_push_release(repo, version):
- repo.index.add(str(p) for p in [FLYCHECK_EL, CHANGELOG])
- repo.index.commit('Release version {}'.format(version))
- repo.create_tag(str(version), message='Flycheck {}'.format(version),
- sign=True)
- repo.remotes.origin.push('master', follow_tags=True)
-
-
-def commit_and_push_snapshot(repo):
- repo.index.add(str(p) for p in [FLYCHECK_EL, CHANGELOG])
- repo.index.commit('Bump version in master')
- repo.remotes.origin.push('master')
-
-
-def build_dist():
- subprocess.run(['cask', 'package'], cwd=str(SOURCE_DIR), check=True)
-
-
-def ask_yes_or_no(prompt):
- return input(prompt).lower() == 'y'
-
-
-def ensure_can_make_release(repo):
- if repo.head.ref != repo.refs.master:
- raise CannotReleaseError(
- 'Cannot make release from branch {}.'
- ' Switch to master!'.format(repo.head.ref))
- if repo.is_dirty(untracked_files=True):
- raise CannotReleaseError(
- 'Cannot release from dirty working directory.'
- ' Please commit or stash all changes!')
- state = BuildState.get_from_github_actions()
- if state.commit != repo.head.ref.object.hexsha:
- raise CannotReleaseError(
- 'HEAD not tested on CI.\n'
- 'Please push your changes and wait for the build to complete.')
- if state.state != 'passed':
- raise CannotReleaseError(
- 'Build not passed (state: {})\n'
- 'Wait for the build to finish or fix the error!'.format(
- state.state))
-
-
-def main():
- try:
- repo = Repo(str(SOURCE_DIR))
- ensure_can_make_release(repo)
-
- current_version = read_version_from_library_header(FLYCHECK_EL)
- next_version = current_version.bump()
-
- if not ask_yes_or_no('Releasing Flycheck {}, '
- 'are you sure? [yn] '.format(next_version)):
- raise CannotReleaseError('Aborted')
-
- set_version_in_library_header(FLYCHECK_EL, next_version)
- finalise_relase_in_changelog(CHANGELOG, next_version, date.today())
- commit_and_push_release(repo, next_version)
- build_dist()
-
- # Now bump to next snapshot version
- next_snapshot = next_version.bump()
- set_version_in_library_header(FLYCHECK_EL, next_snapshot)
- add_snapshot_to_changelog(CHANGELOG, next_snapshot)
- commit_and_push_snapshot(repo)
-
- print('Flycheck {} out now, new snapshot {}! Please'.format(
- next_version, next_snapshot))
- print("""
-* add information about the release to
https://github.com/flycheck/flycheck/releases/edit/{0}
-* upload `dist/flycheck-{0}.tar,
-* enable version {0} on https://readthedocs.org/dashboard/flycheck/versions/,
and
-* announce the release in the flycheck/flycheck Gitter channel.
-""".format(next_version)) # noqa: E501
-
- except CannotReleaseError as error:
- sys.exit(str(error))
-
-
-if __name__ == '__main__':
- main()
diff --git a/maint/requirements.txt b/maint/requirements.txt
deleted file mode 100644
index 390f108af7..0000000000
--- a/maint/requirements.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Network access
-requests>=2.9
-# Git operations
-GitPython>=2.0
-
-# Linting for our Python code
-flake8>=3.0
-pep8>=1.7
-pep8-naming>=0.4
-flake8-quotes>=0.8
-flake8_docstrings>=1.0
-# Workaround for 'pydocstyle has no attribute tokenize_open' error
-# see https://gitlab.com/pycqa/flake8-docstrings/issues/36
-pydocstyle<4