From 5fe81de3bbc2708e5fe89127ecadf4f9a843a3a4 Mon Sep 17 00:00:00 2001 From: tigro Date: Sun, 5 Jan 2025 22:21:38 +0300 Subject: [PATCH] import python-hatch-jupyter-builder-0.9.0-3.el10 --- .gitignore | 1 + .python-hatch-jupyter-builder.metadata | 1 + SOURCES/108.patch | 204 ++++++++++++++++++++++++ SPECS/python-hatch-jupyter-builder.spec | 98 ++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 .gitignore create mode 100644 .python-hatch-jupyter-builder.metadata create mode 100644 SOURCES/108.patch create mode 100644 SPECS/python-hatch-jupyter-builder.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8a4382 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/hatch_jupyter_builder-0.9.0.tar.gz diff --git a/.python-hatch-jupyter-builder.metadata b/.python-hatch-jupyter-builder.metadata new file mode 100644 index 0000000..f98e63c --- /dev/null +++ b/.python-hatch-jupyter-builder.metadata @@ -0,0 +1 @@ +c8f8f8c719df2c64595c267bdc6a201b6c6cae74 SOURCES/hatch_jupyter_builder-0.9.0.tar.gz diff --git a/SOURCES/108.patch b/SOURCES/108.patch new file mode 100644 index 0000000..29f8d08 --- /dev/null +++ b/SOURCES/108.patch @@ -0,0 +1,204 @@ +From c331d2c3bee122c14d7bb62737d7e5108d4d2ac1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 6 Mar 2023 10:33:40 +0100 +Subject: [PATCH 1/2] Use tomllib from the Python 3.11+ standard library + +--- + hatch_jupyter_builder/migrate/_migrate.py | 10 +++++++--- + hatch_jupyter_builder/migrate/cli.py | 2 +- + hatch_jupyter_builder/migrate/jupyter_packaging.py | 8 ++++++-- + pyproject.toml | 2 +- + tests/test_migration.py | 14 +++++++++----- + 5 files changed, 24 insertions(+), 12 deletions(-) + +diff --git a/hatch_jupyter_builder/migrate/_migrate.py b/hatch_jupyter_builder/migrate/_migrate.py +index fbcfedd..a0c5535 100644 +--- a/hatch_jupyter_builder/migrate/_migrate.py ++++ b/hatch_jupyter_builder/migrate/_migrate.py +@@ -6,10 +6,14 @@ + import sys + from pathlib import Path + +-import tomli + import tomli_w # type:ignore[import-not-found] + from packaging import version + ++try: ++ import tomllib ++except ImportError: ++ import tomli as tomllib ++ + logger = logging.getLogger(__name__) + logging.basicConfig() + +@@ -31,7 +35,7 @@ + # Read pyproject before migration to get old build requirements. + pyproject = Path("pyproject.toml") + if pyproject.exists(): +- data = tomli.loads(pyproject.read_text("utf-8")) ++ data = tomllib.loads(pyproject.read_text("utf-8")) + requires = data["build-system"]["requires"] + # Install the old build reqs into this venv. + subprocess.run([sys.executable, "-m", "pip", "install", *requires], check=False) +@@ -105,7 +109,7 @@ + # Migrate and remove unused config. + # Read in the project.toml after auto migration. + logger.info("Migrating static data") +-data = tomli.loads(pyproject.read_text("utf-8")) ++data = tomllib.loads(pyproject.read_text("utf-8")) + tool_table = data.setdefault("tool", {}) + + # Handle license file. +diff --git a/hatch_jupyter_builder/migrate/cli.py b/hatch_jupyter_builder/migrate/cli.py +index a7b5253..81ce524 100644 +--- a/hatch_jupyter_builder/migrate/cli.py ++++ b/hatch_jupyter_builder/migrate/cli.py +@@ -27,7 +27,7 @@ def main(td: str, target_dir: str) -> None: + runner([python, "-m", "pip", "install", "build"]) + runner([python, "-m", "pip", "install", "packaging"]) + runner([python, "-m", "pip", "install", "tomli_w"]) +- runner([python, "-m", "pip", "install", "tomli"]) ++ runner([python, "-m", "pip", "install", "tomli;python_version<'3.11'"]) + runner([python, "-m", "pip", "install", "hatch"]) + runner([python, "-m", "build", target_dir, "--sdist"]) + +diff --git a/hatch_jupyter_builder/migrate/jupyter_packaging.py b/hatch_jupyter_builder/migrate/jupyter_packaging.py +index b0c8ab6..ed3a037 100644 +--- a/hatch_jupyter_builder/migrate/jupyter_packaging.py ++++ b/hatch_jupyter_builder/migrate/jupyter_packaging.py +@@ -6,9 +6,13 @@ + from pathlib import Path + from typing import Any + +-import tomli + import tomli_w # type:ignore[import-not-found] + ++try: ++ import tomllib ++except ImportError: ++ import tomli as tomllib ++ + __this_shim = sys.modules.pop("jupyter_packaging") + __current_directory = sys.path.pop(0) + +@@ -20,7 +24,7 @@ + + def _write_config(path: Any, data: Any) -> None: + pyproject = Path("pyproject.toml") +- top = tomli.loads(pyproject.read_text(encoding="utf-8")) ++ top = tomllib.loads(pyproject.read_text(encoding="utf-8")) + current = top + parts = path.split(".") + for part in parts[:-1]: +diff --git a/pyproject.toml b/pyproject.toml +index 2adf22d..6a0550c 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -45,7 +45,7 @@ test = [ + "pytest", + "pytest-cov", + "pytest-mock", +- "tomli", ++ "tomli;python_version<'3.11'", + "twine", + ] + [project.urls] +diff --git a/tests/test_migration.py b/tests/test_migration.py +index f373b13..ed7822c 100644 +--- a/tests/test_migration.py ++++ b/tests/test_migration.py +@@ -7,7 +7,11 @@ + from pathlib import Path + + import pytest +-import tomli ++ ++try: ++ import tomllib ++except ImportError: ++ import tomli as tomllib + + from hatch_jupyter_builder.compare_migrated.cli import main + +@@ -32,8 +36,8 @@ def test_npm_builder_migration(): + subprocess.check_call([python, "-m", "hatch_jupyter_builder.migrate", target1]) + source_toml = source.joinpath("pyproject.toml").read_text(encoding="utf-8") + target_toml = target1.joinpath("pyproject.toml").read_text(encoding="utf-8") +- source_data = tomli.loads(source_toml) +- target_data = tomli.loads(target_toml) ++ source_data = tomllib.loads(source_toml) ++ target_data = tomllib.loads(target_toml) + + # The hatchling and hatch_jupyter_builder versions might differ. + source_data["build-system"]["requires"] = target_data["build-system"]["requires"] +@@ -87,8 +91,8 @@ def test_create_cmdclass_migration(): + subprocess.check_call([python, "-m", "hatch_jupyter_builder.migrate", target1]) + source_toml = source.joinpath("pyproject.toml").read_text(encoding="utf-8") + target_toml = target1.joinpath("pyproject.toml").read_text(encoding="utf-8") +- source_data = tomli.loads(source_toml) +- target_data = tomli.loads(target_toml) ++ source_data = tomllib.loads(source_toml) ++ target_data = tomllib.loads(target_toml) + + # The hatchling and hatch_jupyter_builder versions might differ. + source_data["build-system"]["requires"] = target_data["build-system"]["requires"] + +From 35749190389d045f74d17d17efdcdbf7f60ca733 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Thu, 9 Mar 2023 12:41:34 +0100 +Subject: [PATCH 2/2] Please the type checker + +--- + hatch_jupyter_builder/migrate/_migrate.py | 4 ++-- + hatch_jupyter_builder/migrate/jupyter_packaging.py | 4 ++-- + tests/test_migration.py | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/hatch_jupyter_builder/migrate/_migrate.py b/hatch_jupyter_builder/migrate/_migrate.py +index a0c5535..383dca8 100644 +--- a/hatch_jupyter_builder/migrate/_migrate.py ++++ b/hatch_jupyter_builder/migrate/_migrate.py +@@ -9,9 +9,9 @@ + import tomli_w # type:ignore[import-not-found] + from packaging import version + +-try: ++if sys.version_info >= (3, 11): + import tomllib +-except ImportError: ++else: + import tomli as tomllib + + logger = logging.getLogger(__name__) +diff --git a/hatch_jupyter_builder/migrate/jupyter_packaging.py b/hatch_jupyter_builder/migrate/jupyter_packaging.py +index ed3a037..9f4bd85 100644 +--- a/hatch_jupyter_builder/migrate/jupyter_packaging.py ++++ b/hatch_jupyter_builder/migrate/jupyter_packaging.py +@@ -8,9 +8,9 @@ + + import tomli_w # type:ignore[import-not-found] + +-try: ++if sys.version_info >= (3, 11): + import tomllib +-except ImportError: ++else: + import tomli as tomllib + + __this_shim = sys.modules.pop("jupyter_packaging") +diff --git a/tests/test_migration.py b/tests/test_migration.py +index ed7822c..9c8b0b0 100644 +--- a/tests/test_migration.py ++++ b/tests/test_migration.py +@@ -8,9 +8,9 @@ + + import pytest + +-try: ++if sys.version_info >= (3, 11): + import tomllib +-except ImportError: ++else: + import tomli as tomllib + + from hatch_jupyter_builder.compare_migrated.cli import main diff --git a/SPECS/python-hatch-jupyter-builder.spec b/SPECS/python-hatch-jupyter-builder.spec new file mode 100644 index 0000000..f865176 --- /dev/null +++ b/SPECS/python-hatch-jupyter-builder.spec @@ -0,0 +1,98 @@ +Name: python-hatch-jupyter-builder +Version: 0.9.0 +Release: 3%{?dist} +Summary: A hatch plugin to help build Jupyter packages +License: BSD-3-Clause +URL: https://pypi.org/project/hatch-jupyter-builder/ +Source: %{pypi_source hatch_jupyter_builder} + +# Use tomllib from the Python 3.11+ standard library +Patch: https://github.com/jupyterlab/hatch-jupyter-builder/pull/108.patch + +BuildArch: noarch +BuildRequires: python3-devel +# Test deps, upstream contains pre-commit, pytest-cov etc. +BuildRequires: python3-pytest +BuildRequires: python3-pytest-mock +BuildRequires: (python3-tomli if python3 < 3.11) + +%global _description %{expand: +This provides a build hook plugin for Hatch that adds +a build step for use with Jupyter packages.} + + +%description %_description + +%package -n python3-hatch-jupyter-builder +Summary: %{summary} + +%description -n python3-hatch-jupyter-builder %_description + + +%prep +%autosetup -p1 -n hatch_jupyter_builder-%{version} + + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files hatch_jupyter_builder + + +%check +# Skipped tests installs from internet +%pytest -k "not test_hatch_build" + + +%files -n python3-hatch-jupyter-builder -f %{pyproject_files} +%doc README.md +%{_bindir}/hatch-jupyter-builder + + +%changelog +* Sun Jan 05 2025 Arkady L. Shane - 0.9.0-3 +- Rebuilt for MSVSphere 10 + +* Fri Jul 19 2024 Fedora Release Engineering - 0.9.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Python Maint - 0.9.0-2 +- Rebuilt for Python 3.13 + +* Tue Mar 12 2024 Lumír Balhar - 0.9.0-1 +- Update to 0.9.0 (rhbz#2269156) + +* Fri Jan 26 2024 Fedora Release Engineering - 0.8.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 0.8.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Sep 13 2023 Miro Hrončok - 0.8.3-4 +- Avoid an unneeded dependency on python3-tomli +- Use tomllib from the Python 3.11+ standard library instead + +* Fri Jul 21 2023 Fedora Release Engineering - 0.8.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Jun 13 2023 Python Maint - 0.8.3-2 +- Rebuilt for Python 3.12 + +* Mon Apr 24 2023 Lumír Balhar - 0.8.3-1 +- Update to 0.8.3 (rhbz#2187226) + +* Fri Jan 20 2023 Fedora Release Engineering - 0.8.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Dec 14 2022 Lumír Balhar - 0.8.2-1 +- Update to 0.8.2 (rhbz#2152911) + +* Mon Nov 28 2022 Lumír Balhar - 0.8.1-1 +- Initial package \ No newline at end of file