mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-17 06:20:27 +00:00
Use package metadata
This commit is contained in:
parent
243d91cc4c
commit
1d10fffde4
5 changed files with 20 additions and 32 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -106,7 +106,7 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
python3 setup.py build
|
||||
python3 setup.py build egg_info
|
||||
make -C doc code
|
||||
make -C doc html
|
||||
make -C doc locale
|
||||
|
|
|
|||
2
.github/workflows/publish-pages.yml
vendored
2
.github/workflows/publish-pages.yml
vendored
|
|
@ -32,7 +32,7 @@ jobs:
|
|||
|
||||
- name: Build
|
||||
run: |
|
||||
python3 setup.py build
|
||||
python3 setup.py build egg_info
|
||||
make -C doc code
|
||||
make -C doc html
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ from .logconf import (
|
|||
)
|
||||
import _LinkChecker_configdata as configdata
|
||||
|
||||
COMMAND_NAME = "linkchecker"
|
||||
PACKAGE_NAME = __package__
|
||||
|
||||
|
||||
|
|
@ -107,8 +108,9 @@ def init_i18n(loc=None):
|
|||
if 'LOCPATH' in os.environ:
|
||||
locdir = os.environ['LOCPATH']
|
||||
else:
|
||||
locdir = os.path.join(get_install_data(), 'share', 'locale')
|
||||
i18n.init(configdata.name.lower(), locdir, loc=loc)
|
||||
# Need Python 3.9 for importlib.resources.files
|
||||
locdir = os.path.join(__path__[0], 'data', 'locale')
|
||||
i18n.init(COMMAND_NAME, locdir, loc=loc)
|
||||
# install translated log level names
|
||||
import logging
|
||||
|
||||
|
|
|
|||
|
|
@ -23,22 +23,30 @@ import re
|
|||
import urllib.parse
|
||||
import shutil
|
||||
import socket
|
||||
|
||||
try:
|
||||
from importlib.metadata import metadata
|
||||
except ImportError:
|
||||
# Python 3.7
|
||||
from importlib_metadata import metadata
|
||||
|
||||
import _LinkChecker_configdata as configdata
|
||||
from .. import log, LOG_CHECK, PACKAGE_NAME, fileutil
|
||||
from .. import log, LOG_CHECK, COMMAND_NAME, PACKAGE_NAME, fileutil
|
||||
from . import confparse
|
||||
from xdg.BaseDirectory import xdg_config_home, xdg_data_home
|
||||
|
||||
Version = configdata.version
|
||||
linkchecker_metadata = metadata(COMMAND_NAME)
|
||||
Version = linkchecker_metadata["Version"]
|
||||
ReleaseDate = configdata.release_date
|
||||
AppName = configdata.name
|
||||
AppName = linkchecker_metadata["Name"]
|
||||
App = AppName + " " + Version
|
||||
Author = configdata.author
|
||||
Author = linkchecker_metadata["Author"]
|
||||
HtmlAuthor = Author.replace(' ', ' ')
|
||||
Copyright = "Copyright (C) 2000-2016 Bastian Kleineidam, 2010-2022 " + Author
|
||||
HtmlCopyright = ("Copyright © 2000-2016 Bastian Kleineidam, 2010-2022 "
|
||||
+ HtmlAuthor)
|
||||
HtmlAppInfo = App + ", " + HtmlCopyright
|
||||
Url = configdata.url
|
||||
Url = linkchecker_metadata["Home-page"]
|
||||
SupportUrl = "https://github.com/linkchecker/linkchecker/issues"
|
||||
UserAgent = "Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, Version, Url)
|
||||
Freeware = (
|
||||
|
|
|
|||
24
setup.py
24
setup.py
|
|
@ -141,7 +141,7 @@ class MyInstallLib(install_lib):
|
|||
cmd_obj = self.distribution.get_command_obj("install")
|
||||
cmd_obj.ensure_finalized()
|
||||
# we have to write a configuration file because we need the
|
||||
# <install_data> directory (and other stuff like author, url, ...)
|
||||
# <install_data> directory
|
||||
# all paths are made absolute by cnormpath()
|
||||
data = []
|
||||
for d in ["purelib", "platlib", "lib", "headers", "scripts", "data"]:
|
||||
|
|
@ -230,28 +230,6 @@ class MyDistribution(Distribution):
|
|||
directory = os.getcwd()
|
||||
filename = self.get_conf_filename(directory)
|
||||
# add metadata
|
||||
metanames = (
|
||||
"name",
|
||||
"version",
|
||||
"author",
|
||||
"author_email",
|
||||
"maintainer",
|
||||
"maintainer_email",
|
||||
"url",
|
||||
"license",
|
||||
"description",
|
||||
"long_description",
|
||||
"keywords",
|
||||
"platforms",
|
||||
"fullname",
|
||||
"contact",
|
||||
"contact_email",
|
||||
)
|
||||
for name in metanames:
|
||||
method = "get_" + name
|
||||
val = getattr(self.metadata, method)()
|
||||
cmd = "%s = %r" % (name, val)
|
||||
data.append(cmd)
|
||||
data.append('release_date = "%s"' % get_release_date())
|
||||
# write the config file
|
||||
util.execute(
|
||||
|
|
|
|||
Loading…
Reference in a new issue