setup: replace the last remnant of pbr with setuptools_scm

setuptools_scm is a standard and robust tool for dynamically getting
version numbers from e.g. git; among its features is the ability to
write the results to a python module that the application can then
import from. This removes the overhead of large modules which introspect
the dist-info to get the version, in favor of importing a frozen string.
This commit is contained in:
Eli Schwartz 2021-12-16 02:20:13 -05:00 committed by David Yang
parent c828377fee
commit c043278a41
10 changed files with 8 additions and 36 deletions

1
.gitignore vendored
View File

@ -81,6 +81,7 @@ ChangeLog
guake/data/gschemas.compiled
.pytest_cache/
releasenotes/notes/reno.cache
guake/_version.py
guake/paths.py
guake/paths.py.dev
RELEASENOTES.rst

View File

@ -188,7 +188,7 @@ black:
checks: black-check flake8 pylint reno-lint
black-check:
PIPENV_IGNORE_VIRTUALENVS=1 pipenv run black --check $(MODULE)
PIPENV_IGNORE_VIRTUALENVS=1 pipenv run black --check $(MODULE) --extend-exclude $(MODULE)/_version.py
flake8:
PIPENV_IGNORE_VIRTUALENVS=1 pipenv run flake8 guake

View File

@ -27,7 +27,6 @@ Here are the system dependencies of Guake for its execution:
- ``python3-cairo``
- ``python3-dbus``
- ``python3-gi``
- ``python3-pbr``
Optional dependencies:

View File

@ -103,7 +103,6 @@ You need to ensure the following points are met in your configuration:
- ``python3-cairo``
- ``python3-dbus``
- ``python3-gi``
- ``python3-pbr``
- ``python3-pip``
- ``python3``

View File

@ -22,19 +22,9 @@ Boston, MA 02110-1301 USA
def guake_version():
# Do not import in the module root to speed up the dbus communication as much as possible
# That being said, importlib.metadata is pretty speedy unlike pbr/pkg_resources
try:
import importlib.metadata as importlib_metadata
except ImportError:
try:
import importlib_metadata
except ImportError:
import pbr.version # Fallback for python < 3.8 unable to install importlib_metadata
from ._version import version
return pbr.version.VersionInfo("guake").version_string()
return importlib_metadata.version("guake")
return version
def vte_version():

View File

@ -408,7 +408,6 @@ def main():
" python3 \\\n"
" python3-dbus \\\n"
" python3-gi \\\n"
" python3-pbr \\\n"
" python3-pip"
)
sys.exit(1)

View File

@ -42,7 +42,7 @@ if [[ $RUN == "1" ]]; then
python-cairo \
python-dbus \
python-gobject \
python-pbr \
python-setuptools-scm \
vte3
fi

View File

@ -46,7 +46,7 @@ if [[ $RUN == "1" ]]; then
python3-cairo \
python3-dbus \
python3-gi \
python3-pbr \
python3-setuptools-scm \
python3-pip \
libgirepository1.0-dev
fi

View File

@ -25,8 +25,8 @@ classifier =
packages =
guake
setup_requires =
pbr
setuptools>=57.5.0
setuptools_scm
install_requires =
importlib_metadata; python_version < '3.8'
typing; python_version < '3.5'
@ -47,9 +47,6 @@ all_files = 1
[upload_sphinx]
upload-dir = doc/build/html
[pbr]
warnerrors = True
[wheel]
universal = 1

View File

@ -1,17 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(pbr=True)
setuptools.setup(use_scm_version={"write_to": "guake/_version.py"})