Skip to content

Commit 29c276f

Browse files
committed
Change to PEP 621
1 parent f4b856f commit 29c276f

File tree

7 files changed

+77
-61
lines changed

7 files changed

+77
-61
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
22
ignore = E126,E127,E128,E302,E305,W503
33
max-line-length = 80
4-
max-complexity = 30
4+
max-complexity = 32

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
README.html
22
build/
33
dist/
4+
logs/
45
.idea/
56
.vscode/
67
*.egg-info/

Makefile

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
11
NAME = $(shell basename $(CURDIR))
22
PYNAME = $(subst -,_,$(NAME))
33

4-
all:
5-
@echo "Type sudo make install|uninstall"
6-
@echo "or make sdist|upload|check|clean"
7-
8-
install:
9-
pip3 install -U --root-user-action=ignore .
10-
11-
uninstall:
12-
pip3 uninstall --root-user-action=ignore $(NAME)
4+
check:
5+
ruff .
6+
flake8 */*.py */*/*.py
7+
vermin -vv --exclude importlib.metadata --no-tips -i */*.py */*/*.py
138

14-
sdist:
9+
build:
1510
rm -rf dist
16-
python3 setup.py sdist bdist_wheel
11+
python3 -m build
1712

18-
upload: sdist
19-
twine3 upload --skip-existing dist/*
20-
21-
check:
22-
flake8 $(PYNAME)/*.py $(PYNAME)/*/*.py setup.py
23-
vermin --no-tips -i $(PYNAME)/*.py $(PYNAME)/*/*.py setup.py
24-
python3 setup.py check
13+
upload: build
14+
twine3 upload dist/*
2515

2616
doc:
2717
update-readme-usage
2818

2919
clean:
30-
@rm -vrf *.egg-info build/ dist/ __pycache__/ \
31-
*/__pycache__ */*/__pycache__
20+
@rm -vrf *.egg-info */*.egg-info .venv/ build/ dist/ __pycache__/ \
21+
*/__pycache__ */*/__pycache__

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Type `pkglog -h` to view the usage summary:
8383
```
8484
usage: pkglog [-h] [-u | -i | -I | -n] [-d DAYS | -a | -b] [-j] [-v] [-c]
8585
[-p {pacman,zypper,apt,dnf} | -f PARSER_PLUGIN]
86-
[-t TIMEGAP] [-P PATH] [-g | -r]
86+
[-t TIMEGAP] [-P PATH] [-g | -r] [-V]
8787
[package]
8888
8989
Reports concise log of package changes.
@@ -116,6 +116,7 @@ options:
116116
must be time sequenced)
117117
-g, --glob given package name is glob pattern to match
118118
-r, --regex given package name is regular expression to match
119+
-V, --version show pkglog version
119120
120121
Note you can set default starting options in ~/.config/pkglog-flags.conf.
121122
```
@@ -148,29 +149,29 @@ ensure that `python3-pip` and `python3-wheel` are installed then type
148149
the following to install (or upgrade):
149150

150151
```
151-
$ sudo pip3 install -U --use-pep517 --root-user-action=ignore pkglog
152+
$ sudo pip3 install -U pkglog
152153
```
153154

154155
Alternatively, do the following to install from the source repository.
155156

156157
```sh
157158
$ git clone http://github.com/bulletmark/pkglog
158159
$ cd pkglog
159-
$ sudo pip3 install -U --use-pep517 --root-user-action=ignore .
160+
$ sudo pip3 install -U .
160161
```
161162

162163
## UPGRADE
163164

164165
```sh
165166
$ cd pkglog # Source dir, as above
166167
$ git pull
167-
$ sudo pip3 install -U --use-pep517 --root-user-action=ignore .
168+
$ sudo pip3 install -U .
168169
```
169170

170171
## REMOVAL
171172

172173
```sh
173-
$ sudo pip3 uninstall --root-user-action=ignore pkglog
174+
$ sudo pip3 uninstall pkglog
174175
```
175176

176177
## LICENSE

pkglog/pkglog.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ def main():
219219
help='given package name is glob pattern to match')
220220
grp2.add_argument('-r', '--regex', action='store_true',
221221
help='given package name is regular expression to match')
222+
opt.add_argument('-V', '--version', action='store_true',
223+
help=f'show {opt.prog} version')
222224
opt.add_argument('package', nargs='?',
223225
help='specific package name to report')
224226

@@ -234,6 +236,20 @@ def main():
234236

235237
args = opt.parse_args(shlex.split(cnflines) + sys.argv[1:])
236238

239+
if args.version:
240+
try:
241+
from importlib.metadata import version
242+
except ImportError:
243+
from importlib_metadata import version
244+
245+
try:
246+
ver = version(opt.prog)
247+
except Exception:
248+
ver = 'unknown'
249+
250+
print(ver)
251+
return
252+
237253
Queue.no_color = args.no_color or not sys.stdout.isatty()
238254

239255
if args.parser_plugin:

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "setuptools-scm[toml]>=6.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pkglog"
7+
description = "Reports concise log of package changes"
8+
readme = "README.md"
9+
authors = [
10+
{name = "Mark Blakeney", email = "[email protected]"},
11+
]
12+
requires-python = ">=3.7"
13+
keywords = ["pacman", "apt-get", "apt", "dnf"]
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
]
17+
dynamic = ["version"]
18+
dependencies = [
19+
"importlib-metadata; python_version < '3.8'",
20+
]
21+
22+
[project.urls]
23+
Homepage = "https://github.com/bulletmark/pkglog"
24+
25+
[project.scripts]
26+
pkglog = "pkglog.pkglog:main"
27+
28+
[project.license]
29+
text = "GPLv3"
30+
31+
[tool.setuptools.packages.find]
32+
where = ["pkglog"]
33+
34+
[tool.setuptools_scm]
35+
version_scheme = "post-release"
36+
37+
[tool.edit-lint]
38+
linters = [
39+
"ruff",
40+
"flake8",
41+
]
42+
43+
# vim:se sw=2:

setup.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)