Notification time stamped 2023-06-30 14:20:35 UTC
From c9179892bbf8525dce5f6cceac49f6bd9d1272b8 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley code@musicinmybrain.net Date: Jun 20 2023 18:57:29 +0000 Subject: Update to 4.5 (close RHBZ#2216270)
---
diff --git a/.gitignore b/.gitignore index afb5a27..531c626 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /PyScaffold-4.1.tar.gz /PyScaffold-4.2.1.tar.gz /PyScaffold-4.4.1.tar.gz +/PyScaffold-4.5.tar.gz diff --git a/PyScaffold-4.2.1-no-coverage.patch b/PyScaffold-4.2.1-no-coverage.patch deleted file mode 100644 index b661d59..0000000 --- a/PyScaffold-4.2.1-no-coverage.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -Naur PyScaffold-4.2.1-original/setup.cfg PyScaffold-4.2.1/setup.cfg ---- PyScaffold-4.2.1-original/setup.cfg 2022-03-16 12:59:33.000000000 -0400 -+++ PyScaffold-4.2.1/setup.cfg 2022-04-13 14:50:30.994122384 -0400 -@@ -76,10 +76,8 @@ - tox # system tests use tox inside tox - pre-commit # system tests run pre-commit - sphinx # system tests build docs -- flake8 # system tests run flake8 - virtualenv # virtualenv as dependency for the venv extension in `-e fast` - pytest -- pytest-cov - pytest-shutil - pytest-virtualenv - pytest-fixture-config -@@ -104,7 +102,6 @@ - - [tool:pytest] - addopts = -- --cov pyscaffold --cov-config .coveragerc --cov-report term-missing - --verbose - norecursedirs = - dist diff --git a/PyScaffold-4.4.1-platformdirs3.patch b/PyScaffold-4.4.1-platformdirs3.patch deleted file mode 100644 index 55d8066..0000000 --- a/PyScaffold-4.4.1-platformdirs3.patch +++ /dev/null @@ -1,360 +0,0 @@ -From 9eb8e31d5702745b712dcc01f35452f7efee69e6 Mon Sep 17 00:00:00 2001 -From: "Benjamin A. Beasley" code@musicinmybrain.net -Date: Tue, 30 May 2023 08:23:51 -0400 -Subject: [PATCH 1/6] Allow platformdirs 3.x (fix #719) - ---- - setup.cfg | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.cfg b/setup.cfg -index 47f2a970f..965eff673 100644 ---- a/setup.cfg -+++ b/setup.cfg -@@ -39,7 +39,7 @@ package_dir = - =src - install_requires = - importlib-metadata; python_version<"3.8" -- platformdirs>=2,<3 -+ platformdirs>=2,<4 - configupdater>=3.0,<4 # pyscaffoldext-custom-extension should have a compatible range - setuptools>=46.1.0 - setuptools_scm>=5 - -From 5758a636e38532bee399fa5bf3fcf178a4f874a6 Mon Sep 17 00:00:00 2001 -From: Anderson Bravalheri andersonbravalheri@gmail.com -Date: Thu, 15 Jun 2023 14:52:03 +0100 -Subject: [PATCH 2/6] Handle migration of macOS config files due to - platformdirs upgrade - ---- - src/pyscaffold/api.py | 1 + - src/pyscaffold/info.py | 32 ++++++++++++++++++++ - tests/test_api.py | 66 +++++++++++++++++++++++++++++++++--------- - 3 files changed, 85 insertions(+), 14 deletions(-) - -diff --git a/src/pyscaffold/api.py b/src/pyscaffold/api.py -index 59ca325e7..a43a1d6aa 100644 ---- a/src/pyscaffold/api.py -+++ b/src/pyscaffold/api.py -@@ -70,6 +70,7 @@ def bootstrap_options(opts=None, **kwargs): - # ^ remove empty items, so we ensure setdefault works - - # Add options stored in config files: -+ info._migrate_old_config() - default_files = [info.config_file(default=None)] - opts.setdefault("config_files", [f for f in default_files if f and f.exists()]) - # ^ make sure the file exists before passing it ahead -diff --git a/src/pyscaffold/info.py b/src/pyscaffold/info.py -index 8cb82797a..e88635c6d 100644 ---- a/src/pyscaffold/info.py -+++ b/src/pyscaffold/info.py -@@ -6,6 +6,7 @@ - import getpass - import os - import socket -+import sys - from enum import Enum - from operator import itemgetter - from pathlib import Path -@@ -387,3 +388,34 @@ def config_file(name=CONFIG_FILE, prog=PKG_NAME, org=None, default=RAISE_EXCEPTI - return default_file - - return dir / name -+ -+ -+def _old_macos_config_dir(new_dir): -+ return Path( -+ str(new_dir) -+ .replace(os.sep, "/") -+ .replace("/Library/Application Support/", "/Library/Preferences/") -+ ) -+ -+ -+def _migrate_old_config(prog=PKG_NAME, org=None): -+ """Compensate for macOS backward incompatible change in platformdirs 3.0.0""" -+ if not sys.platform.startswith("darwin"): -+ return -+ -+ try: -+ new_dir = config_dir(prog, org) -+ old_dir = _old_macos_config_dir(new_dir) -+ if new_dir.exists() or not old_dir.exists(): -+ return -+ -+ logger.report("move", str(old_dir), target=str(new_dir)) -+ new_dir.parent.mkdir(parents=True, exist_ok=True) -+ old_dir.rename(new_dir) -+ except Exception: -+ logger.debug( -+ "Error trying to migrate old macOS config dir. " -+ "If you have an older PyScaffold config file, please make sure to " -+ f"manually copy it to `~/Library/Application Support/{prog}/`", -+ exc_info=True, -+ ) -diff --git a/tests/test_api.py b/tests/test_api.py -index 25bc3ac8f..d361949a2 100644 ---- a/tests/test_api.py -+++ b/tests/test_api.py -@@ -1,5 +1,6 @@ - from os.path import getmtime - from pathlib import Path -+from tempfile import TemporaryDirectory - from textwrap import dedent - - import pytest -@@ -228,23 +229,23 @@ def test_bootstrap_using_config_file(tmpfolder): - assert all(k in new_opts for k in "author email url".split()) - - -+DEFAULT_CONFIG = """\ -+[metadata] -+author = John Doe -+author-email = john.joe@gmail.com -+ -+[pyscaffold] -+extensions = -+ namespace -+ cirrus -+namespace = my_namespace.my_sub_namespace -+""" -+ -+ - @pytest.fixture - def with_default_config(fake_config_dir): -- config = dedent( -- """\ -- [metadata] -- author = John Doe -- author-email = john.joe@gmail.com -- -- [pyscaffold] -- extensions = -- namespace -- cirrus -- namespace = my_namespace.my_sub_namespace -- """ -- ) - cfg = fake_config_dir / info.CONFIG_FILE -- cfg.write_text(config) -+ cfg.write_text(DEFAULT_CONFIG) - - yield cfg - -@@ -281,6 +282,43 @@ def test_bootstrap_with_no_config(tmpfolder, with_default_config): - assert " ".join(extensions_names) != "cirrus namespace" - - -+@pytest.fixture -+def macos_config_dir(tmp_path, monkeypatch, fake_config_dir): -+ with TemporaryDirectory(prefix="config", dir=str(tmp_path)) as tmp: -+ confdir = Path(tmp, "Library/Application Support/pyscaffold") -+ -+ _ = fake_config_dir # included for reproducible ordering of fixture evaluation -+ monkeypatch.setattr("pyscaffold.info.config_dir", lambda *_, **__: confdir) -+ yield confdir -+ -+ -+def test_bootstrap_with_legacy_macos_default_config( -+ monkeypatch, tmpfolder, macos_config_dir -+): -+ monkeypatch.setattr("sys.platform", "darwin_test") # pretend to be on macOS -+ # Given a default config file in an outdated config dir on macOS -+ # (see platformdirs v3.0.0) -+ new_dir = macos_config_dir -+ assert not new_dir.exists() # sanity check -+ old_dir = info._old_macos_config_dir(new_dir) -+ old_dir.mkdir(parents=True, exist_ok=False) -+ (old_dir / "default.cfg").write_text(DEFAULT_CONFIG) -+ # when bootstrapping options -+ opts = dict(project_path="xoxo") -+ new_opts = bootstrap_options(opts) -+ # the old directory will be moved to the new location -+ assert new_dir.exists() -+ assert not old_dir.exists() -+ # and the stuff in the old config will be considered -+ assert new_opts["author"] == "John Doe" -+ assert new_opts["email"] == "john.joe@gmail.com" -+ assert new_opts["namespace"] == "my_namespace.my_sub_namespace" -+ extensions = new_opts["extensions"] -+ assert len(extensions) == 2 -+ extensions_names = sorted(e.name for e in extensions) -+ assert " ".join(extensions_names) == "cirrus namespace" -+ -+ - def test_create_project_with_default_config(tmpfolder, with_default_config): - # Given a default config file exists and contains stuff - _ = with_default_config - -From 603d0286c39f7a9acc2a8900c3ece8f3b2afdfdb Mon Sep 17 00:00:00 2001 -From: Anderson Bravalheri andersonbravalheri@gmail.com -Date: Thu, 15 Jun 2023 15:10:48 +0100 -Subject: [PATCH 3/6] Update changelog - ---- - CHANGELOG.rst | 12 ++++++++++++ - docs/conf.py | 3 ++- - docs/requirements.txt | 1 + - 3 files changed, 15 insertions(+), 1 deletion(-) - -diff --git a/CHANGELOG.rst b/CHANGELOG.rst -index 9d1e0a2f9..05d8d1e81 100644 ---- a/CHANGELOG.rst -+++ b/CHANGELOG.rst -@@ -11,6 +11,18 @@ Changelog - ------------------------- - - -+Development version -+=================== -+ -+Version 4.5.0, 2023-XX-XX -+------------------------- -+ -+- Change macOS default configuration dir from -+ ``~/Library/Preferences`` to ``~/Library/Application Support``. -+ This change is motivated by a change in the ``platformdirs`` dependency. -+ You can read more about the motivation in :github:`platformdirs/platformdirs#98` -+ -+ - Current versions - ================ - -diff --git a/docs/conf.py b/docs/conf.py -index 6bc7daf75..7703ecba8 100644 ---- a/docs/conf.py -+++ b/docs/conf.py -@@ -75,6 +75,7 @@ - "sphinx.ext.extlinks", - "sphinx_copybutton", - "sphinxemoji.sphinxemoji", -+ "sphinx_github_role", - ] - - # TODO: Autodoc cannot leave type hints alone (without expansion), as result the docs -@@ -315,7 +316,7 @@ - "pr": (f"{repository}/pull/%s", "PR #%s"), - "discussion": (f"{repository}/discussions/%s", "discussion #%s"), - "pypi": ("https://pypi.org/project/%s", "%s"), -- "github": ("https://github.com/%s", "%s"), -+ # "github" is handled by sphinx_github_role - } - - print(f"loading configurations for {project} {version} ...", file=sys.stderr) -diff --git a/docs/requirements.txt b/docs/requirements.txt -index 9f48b534e..4890f5bbd 100644 ---- a/docs/requirements.txt -+++ b/docs/requirements.txt -@@ -8,5 +8,6 @@ setuptools>=38.3 - setuptools_scm - sphinx>=3.2.1 - sphinx-copybutton -+sphinx-github-role>=0.1,<2 - sphinxemoji - tomlkit - -From 21554eeecb52f8e3e01440ae44635aabb271a512 Mon Sep 17 00:00:00 2001 -From: Anderson Bravalheri andersonbravalheri@gmail.com -Date: Thu, 15 Jun 2023 15:16:22 +0100 -Subject: [PATCH 4/6] Add type checking to _migrate_old_config function - ---- - src/pyscaffold/info.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/pyscaffold/info.py b/src/pyscaffold/info.py -index e88635c6d..c9deacdec 100644 ---- a/src/pyscaffold/info.py -+++ b/src/pyscaffold/info.py -@@ -390,7 +390,7 @@ def config_file(name=CONFIG_FILE, prog=PKG_NAME, org=None, default=RAISE_EXCEPTI - return dir / name - - --def _old_macos_config_dir(new_dir): -+def _old_macos_config_dir(new_dir: Path) -> Path: - return Path( - str(new_dir) - .replace(os.sep, "/") -@@ -398,7 +398,7 @@ def _old_macos_config_dir(new_dir): - ) - - --def _migrate_old_config(prog=PKG_NAME, org=None): -+def _migrate_old_config(prog: str = PKG_NAME, org: Optional[str] = None): - """Compensate for macOS backward incompatible change in platformdirs 3.0.0""" - if not sys.platform.startswith("darwin"): - return - -From 452ec7f4542cfa170499c425758a49a5fa2902d0 Mon Sep 17 00:00:00 2001 -From: Anderson Bravalheri andersonbravalheri@gmail.com -Date: Thu, 15 Jun 2023 15:17:08 +0100 -Subject: [PATCH 5/6] Rename _migrage_old_{,macos_}config - ---- - src/pyscaffold/api.py | 2 +- - src/pyscaffold/info.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/pyscaffold/api.py b/src/pyscaffold/api.py -index a43a1d6aa..7f2443aad 100644 ---- a/src/pyscaffold/api.py -+++ b/src/pyscaffold/api.py -@@ -70,7 +70,7 @@ def bootstrap_options(opts=None, **kwargs): - # ^ remove empty items, so we ensure setdefault works - - # Add options stored in config files: -- info._migrate_old_config() -+ info._migrate_old_macos_config() - default_files = [info.config_file(default=None)] - opts.setdefault("config_files", [f for f in default_files if f and f.exists()]) - # ^ make sure the file exists before passing it ahead -diff --git a/src/pyscaffold/info.py b/src/pyscaffold/info.py -index c9deacdec..44f03e50e 100644 ---- a/src/pyscaffold/info.py -+++ b/src/pyscaffold/info.py -@@ -398,7 +398,7 @@ def _old_macos_config_dir(new_dir: Path) -> Path: - ) - - --def _migrate_old_config(prog: str = PKG_NAME, org: Optional[str] = None): -+def _migrate_old_macos_config(prog: str = PKG_NAME, org: Optional[str] = None): - """Compensate for macOS backward incompatible change in platformdirs 3.0.0""" - if not sys.platform.startswith("darwin"): - return - -From 3a30c92aa3ff1d7870df1c725bf7123e0eefbbf9 Mon Sep 17 00:00:00 2001 -From: Anderson Bravalheri andersonbravalheri@gmail.com -Date: Thu, 15 Jun 2023 16:58:56 +0100 -Subject: [PATCH 6/6] Minor adjustments in CHANGELOG and coverage - ---- - CHANGELOG.rst | 2 +- - src/pyscaffold/info.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/CHANGELOG.rst b/CHANGELOG.rst -index 05d8d1e81..3f7109440 100644 ---- a/CHANGELOG.rst -+++ b/CHANGELOG.rst -@@ -18,7 +18,7 @@ Version 4.5.0, 2023-XX-XX - ------------------------- - - - Change macOS default configuration dir from -- ``~/Library/Preferences`` to ``~/Library/Application Support``. -+ ``~/Library/Preferences`` to ``~/Library/Application Support``, :pr:`721`. - This change is motivated by a change in the ``platformdirs`` dependency. - You can read more about the motivation in :github:`platformdirs/platformdirs#98` - -diff --git a/src/pyscaffold/info.py b/src/pyscaffold/info.py -index 44f03e50e..b9853b68f 100644 ---- a/src/pyscaffold/info.py -+++ b/src/pyscaffold/info.py -@@ -412,7 +412,7 @@ def _migrate_old_macos_config(prog: str = PKG_NAME, org: Optional[str] = None): - logger.report("move", str(old_dir), target=str(new_dir)) - new_dir.parent.mkdir(parents=True, exist_ok=True) - old_dir.rename(new_dir) -- except Exception: -+ except Exception: # pragma: no cover - logger.debug( - "Error trying to migrate old macOS config dir. " - "If you have an older PyScaffold config file, please make sure to " diff --git a/PyScaffold-4.5-no-coverage.patch b/PyScaffold-4.5-no-coverage.patch new file mode 100644 index 0000000..ba17379 --- /dev/null +++ b/PyScaffold-4.5-no-coverage.patch @@ -0,0 +1,22 @@ +diff -Naur PyScaffold-4.5-original/setup.cfg PyScaffold-4.5/setup.cfg +--- PyScaffold-4.5-original/setup.cfg 2023-06-20 12:24:51.000000000 -0400 ++++ PyScaffold-4.5/setup.cfg 2023-06-20 14:57:18.276518430 -0400 +@@ -76,10 +76,8 @@ + tox # system tests use tox inside tox + pre-commit # system tests run pre-commit + sphinx # system tests build docs +- flake8 # system tests run flake8 + virtualenv # virtualenv as dependency for the venv extension in `-e fast` + pytest +- pytest-cov + pytest-xdist + pytest-randomly + +@@ -101,7 +99,6 @@ + + [tool:pytest] + addopts = +- --cov pyscaffold --cov-config .coveragerc --cov-report term-missing + --verbose + norecursedirs = + dist diff --git a/python-pyscaffold.spec b/python-pyscaffold.spec index 45e8081..602df24 100644 --- a/python-pyscaffold.spec +++ b/python-pyscaffold.spec @@ -7,7 +7,7 @@ %bcond doc_pdf 1
Name: python-pyscaffold -Version: 4.4.1 +Version: 4.5 Release: %autorelease Summary: Template tool for putting up the scaffold of a Python project
@@ -25,15 +25,10 @@ Source1: putup.1
# Downstream-only: do not run coverage analysis # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters -Patch: PyScaffold-4.2.1-no-coverage.patch +Patch: PyScaffold-4.5-no-coverage.patch # Downstream-only: remove animated demo from docs since this cannot be included # in a PDF Patch: PyScaffold-4.1-no-animated-doc-demo.patch -# Allow platformdirs 3.x -# https://github.com/pyscaffold/pyscaffold/pull/721 -# Hand-edited to apply to PyPI setup.cfg, where whitespace is automatically -# munged. -Patch: PyScaffold-4.4.1-platformdirs3.patch
BuildArch: noarch
diff --git a/sources b/sources index 5254bac..9f3021d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (PyScaffold-4.4.1.tar.gz) = d86f19f392f590b4a789a78e647171fff1ecab27ee3e88f9168872caa258b133b6c455dd254dc432f80303c31a0afad94b7107f52a50f495ea5e7a7ff630fa7a +SHA512 (PyScaffold-4.5.tar.gz) = 3fefd712adf235883b3c3489f86be11fb11800a19193ee3479b521f6e53afc037acb88fa49bb58d3fe55172caeb9feb249a66eccfe9a71c15e112a3aa5719764
https://src.fedoraproject.org/rpms/python-pyscaffold/c/c9179892bbf8525dce5f6...
scm-commits@lists.fedoraproject.org