mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-25 08:34:43 +00:00
Write all metadata used to _release.py
Enables running without installing. Removes use of importlib.metadata.
This commit is contained in:
parent
30e8cfad77
commit
af265f3d52
7 changed files with 41 additions and 32 deletions
1
.github/workflows/branch-man.yml
vendored
1
.github/workflows/branch-man.yml
vendored
|
|
@ -38,6 +38,7 @@ jobs:
|
|||
|
||||
- name: Build man pages
|
||||
run: |
|
||||
python3 -m hatchling build --hooks-only
|
||||
hatch -e doc run locale
|
||||
git commit -a -m "Update doc translation catalogs"
|
||||
hatch -e doc run man
|
||||
|
|
|
|||
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
|
@ -66,7 +66,9 @@ jobs:
|
|||
while ! test -S /var/run/clamav/clamd.ctl; do printf "."; sleep 1; done
|
||||
|
||||
- name: Run tests
|
||||
run: python -m tox -e py
|
||||
run: |
|
||||
python -m hatchling build --hooks-only
|
||||
python -m tox -e py
|
||||
|
||||
- name: Report to coveralls
|
||||
run: coveralls
|
||||
|
|
|
|||
1
.github/workflows/publish-pages.yml
vendored
1
.github/workflows/publish-pages.yml
vendored
|
|
@ -35,6 +35,7 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
python3 -m hatchling build --hooks-only
|
||||
hatch -e doc run code
|
||||
hatch -e doc run html
|
||||
|
||||
|
|
|
|||
|
|
@ -12,18 +12,22 @@ participate in the community, you should rather look into
|
|||
Requirements
|
||||
------------
|
||||
|
||||
hatchling and hatch-vcs are used to create the application metadata and build
|
||||
distribution packages.
|
||||
|
||||
These requirements are in addition to the dependencies covered in the
|
||||
[installation instructions](install.txt).
|
||||
|
||||
Developers will likely want to install hatch.
|
||||
Developers may wish to install hatch or tox to manage running tests.
|
||||
|
||||
To run the copy of linkchecker in the local repository:
|
||||
To run the copy of linkchecker in the local repository first create the
|
||||
metadata in linkcheck/_release.py:
|
||||
|
||||
hatch env remove
|
||||
hatch run linkchecker
|
||||
hatchling build -t sdist --hooks-only
|
||||
|
||||
If LinkChecker is already installed, `python -m linkcheck` will work, but the
|
||||
metadata of the installed version will be used to e.g. provide the version number.
|
||||
Then linkchecker can be run with:
|
||||
|
||||
python -m linkcheck
|
||||
|
||||
Workflows using GitHub Actions are used to check every PR, each commit and
|
||||
regularly the repository HEAD. Developers are able to perform these checks
|
||||
|
|
@ -62,8 +66,7 @@ Release process
|
|||
if so create a pull request using the GitHub workflow:
|
||||
"Create a branch with updated man pages and application translations"
|
||||
|
||||
2. edit `changelog.txt` and `upgrading.txt`, and if applicable the
|
||||
copyright dates in `linkcheck/configuration/__init__.py`
|
||||
2. edit `changelog.txt` and `upgrading.txt`
|
||||
|
||||
3. confirm tests have passed
|
||||
|
||||
|
|
|
|||
|
|
@ -24,33 +24,28 @@ import urllib.parse
|
|||
import shutil
|
||||
import socket
|
||||
|
||||
try:
|
||||
from importlib.metadata import distribution
|
||||
except ImportError:
|
||||
# Python 3.7
|
||||
from importlib_metadata import distribution
|
||||
|
||||
from .. import log, LOG_CHECK, COMMAND_NAME, PACKAGE_NAME, fileutil
|
||||
from .. import log, LOG_CHECK, PACKAGE_NAME, fileutil
|
||||
from . import confparse
|
||||
|
||||
linkchecker_distribution = distribution(COMMAND_NAME)
|
||||
Version = linkchecker_distribution.metadata["Version"]
|
||||
try:
|
||||
from .. import _release
|
||||
except ImportError:
|
||||
ReleaseDate = "unknown"
|
||||
else:
|
||||
ReleaseDate = _release.__release_date__
|
||||
AppName = linkchecker_distribution.metadata["Name"]
|
||||
raise SystemExit('Run "hatchling build --hooks-only" first')
|
||||
|
||||
Version = _release.__version__
|
||||
ReleaseDate = _release.__release_date__
|
||||
CopyrightYear = _release.__copyright_year__
|
||||
AppName = _release.__app_name__
|
||||
App = AppName + " " + Version
|
||||
Author = linkchecker_distribution.metadata["Author"]
|
||||
Author = _release.__author__
|
||||
HtmlAuthor = Author.replace(' ', ' ')
|
||||
Copyright = "Copyright (C) 2000-2016 Bastian Kleineidam, 2010-2022 " + Author
|
||||
HtmlCopyright = ("Copyright © 2000-2016 Bastian Kleineidam, 2010-2022 "
|
||||
+ HtmlAuthor)
|
||||
Copyright = f"Copyright (C) 2000-2016 Bastian Kleineidam, 2010-{CopyrightYear} {Author}"
|
||||
HtmlCopyright = (
|
||||
"Copyright © 2000-2016 Bastian Kleineidam, "
|
||||
f"2010-{CopyrightYear} {HtmlAuthor}")
|
||||
HtmlAppInfo = App + ", " + HtmlCopyright
|
||||
Url = linkchecker_distribution.metadata["Project-URL"].split(", ")[1]
|
||||
SupportUrl = "https://github.com/linkchecker/linkchecker/issues"
|
||||
Url = _release.__url__
|
||||
SupportUrl = _release.__support_url__
|
||||
UserAgent = "Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, Version, Url)
|
||||
Freeware = (
|
||||
AppName
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ classifiers = [
|
|||
requires-python = ">=3.7"
|
||||
|
||||
dependencies = [
|
||||
"importlib_metadata;python_version<'3.8'",
|
||||
"requests >= 2.4",
|
||||
"dnspython >= 2.0",
|
||||
"beautifulsoup4 >= 4.8.1",
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class CustomBuildHook(BuildHookInterface):
|
|||
|
||||
def initialize(self, version, build_data):
|
||||
cp = None
|
||||
committer_date = "unknown"
|
||||
committer_date = committer_year = "unknown"
|
||||
try:
|
||||
cp = subprocess.run(["git", "log", "-n 1", "HEAD", "--format=%cs"],
|
||||
capture_output=True, text=True)
|
||||
|
|
@ -47,9 +47,17 @@ class CustomBuildHook(BuildHookInterface):
|
|||
else:
|
||||
if cp and cp.stdout:
|
||||
committer_date = cp.stdout.strip()
|
||||
committer_year = committer_date[:4]
|
||||
|
||||
Path(*RELEASE_PY).write_text(
|
||||
f"__release_date__ = \"{committer_date}\"\n")
|
||||
Path(*RELEASE_PY).write_text(f"""\
|
||||
__app_name__ = "{self.metadata.core.raw_name}"
|
||||
__version__ = "{self.metadata.version}"
|
||||
__release_date__ = "{committer_date}"
|
||||
__copyright_year__ = "{committer_year}"
|
||||
__author__ = "{self.metadata.core.authors[0]['name']}"
|
||||
__url__ = "{self.metadata.core.urls["Homepage"]}"
|
||||
__support_url__ = "{self.metadata.core.urls["Bug Tracker"]}"
|
||||
""")
|
||||
|
||||
if COMPILE_TRANSLATIONS:
|
||||
for po in Path("po").glob("*.po"):
|
||||
|
|
|
|||
Loading…
Reference in a new issue