diff --git a/.gitignore b/.gitignore index f8990dc04..dd1647738 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile b/Makefile index 3c1843203..883d9e674 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/docs/source/contributing/packaging.rst b/docs/source/contributing/packaging.rst index ff4490173..8b8c23b97 100644 --- a/docs/source/contributing/packaging.rst +++ b/docs/source/contributing/packaging.rst @@ -27,7 +27,6 @@ Here are the system dependencies of Guake for its execution: - ``python3-cairo`` - ``python3-dbus`` - ``python3-gi`` -- ``python3-pbr`` Optional dependencies: diff --git a/docs/source/user/installing.rst b/docs/source/user/installing.rst index 3f3a49251..c83245cae 100644 --- a/docs/source/user/installing.rst +++ b/docs/source/user/installing.rst @@ -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`` diff --git a/guake/__init__.py b/guake/__init__.py index ba98381e2..63e9bd861 100644 --- a/guake/__init__.py +++ b/guake/__init__.py @@ -22,19 +22,9 @@ 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 - - return pbr.version.VersionInfo("guake").version_string() - - return importlib_metadata.version("guake") + from ._version import version + + return version def vte_version(): diff --git a/guake/main.py b/guake/main.py index 98c6ef3b0..3d909ecb6 100644 --- a/guake/main.py +++ b/guake/main.py @@ -408,7 +408,6 @@ def main(): " python3 \\\n" " python3-dbus \\\n" " python3-gi \\\n" - " python3-pbr \\\n" " python3-pip" ) sys.exit(1) diff --git a/releasenotes/notes/switch_versioning_setuptools_scm-6481ee944dbb5d0a.yaml b/releasenotes/notes/switch_versioning_setuptools_scm-6481ee944dbb5d0a.yaml new file mode 100644 index 000000000..24a517045 --- /dev/null +++ b/releasenotes/notes/switch_versioning_setuptools_scm-6481ee944dbb5d0a.yaml @@ -0,0 +1,6 @@ +release_summary: > + Deprecated pbr + +notes_for_package_maintainers: + - | + Switched from importlib + pbr to setuptools_scm for versioning diff --git a/scripts/bootstrap-dev-arch.sh b/scripts/bootstrap-dev-arch.sh index 252a21a85..9abe66152 100755 --- a/scripts/bootstrap-dev-arch.sh +++ b/scripts/bootstrap-dev-arch.sh @@ -42,7 +42,7 @@ if [[ $RUN == "1" ]]; then python-cairo \ python-dbus \ python-gobject \ - python-pbr \ + python-setuptools-scm \ vte3 fi diff --git a/scripts/bootstrap-dev-debian.sh b/scripts/bootstrap-dev-debian.sh index f04e1020f..31a4a225a 100755 --- a/scripts/bootstrap-dev-debian.sh +++ b/scripts/bootstrap-dev-debian.sh @@ -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 diff --git a/setup.cfg b/setup.cfg index 11dd6fc75..702e5eb1e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,14 +25,14 @@ 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' -[files] -data_files = - share/guake/po = po/* +[options.data_files] +share/guake/po = po/*.mo [options.entry_points] console_scripts = @@ -47,9 +47,6 @@ all_files = 1 [upload_sphinx] upload-dir = doc/build/html -[pbr] -warnerrors = True - [wheel] universal = 1 diff --git a/setup.py b/setup.py index a4959d5d8..1dd751ae4 100644 --- a/setup.py +++ b/setup.py @@ -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"})