From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 27 Sep 2024 13:39:55 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1su9KE-003O6x-1u for lore@lore.pengutronix.de; Fri, 27 Sep 2024 13:39:55 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1su9KF-0007Q8-8m; Fri, 27 Sep 2024 13:39:55 +0200 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1su9Jm-0006t8-Pn for ptxdist@pengutronix.de; Fri, 27 Sep 2024 13:39:27 +0200 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-537a2a2c74fso2875167e87.0 for ; Fri, 27 Sep 2024 04:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727437166; x=1728041966; darn=pengutronix.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LC4t0N/rQFC4c9Vg+MssQSoVtHnKwTJ8lvieqH0UyAs=; b=UK70ZSREsnE8hzZXa/5GnzGUaFmLdGrC8/kvVrhlIabAw93HUQzlAqsRl3ftkAFqzh l0gPjpL0ZLAMy+nsukuNn1di1Xkgdvh1Lr5c3VwHs5fJvrTTBCUkN1vqfPgJ9C8ZuxJy ZjgFK31C5LWfcMWY7fgAJoj8fBykK1emUqpIjUvmtXR4XyMxJpLoNF1Z9qROlkI+0WIZ bKmTIcO7mjDpEcNv5HUuje3/etUhv6xW+YFiiTrFQo+0EwsSdecz0sPPFdeU7xTniUTs dtDOEJMS7ZwPzSxocRf7Ad/N62xWtGEwDjyn1J8nkkrG941jHKSPVSDPXvGgL14o1MT8 hxUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727437166; x=1728041966; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LC4t0N/rQFC4c9Vg+MssQSoVtHnKwTJ8lvieqH0UyAs=; b=M0uCJQSGRUGwJeNiYnqsu6YMEllme/hFywmc362rjZTvdcJv0TJh1Y+CayXqS9p0N0 04prYdJsDSNvlr3WfYN1bPXxKVKRGYKg3IOm2qS6i0+G2M9af+QjjGvovhmBYOmjV7ON y8aXsqZ7i/tjRJvaMme8wFx33M/juE8XAdv+EZRhLJ1yhgC0dq/MRQfRW2bfXlspdhQx hVxlD11fH675TzbgtBrlyRWRlBjZOXF0tXWzkCz41rXXqQW/JzP5C6AbUePKUXhw2ou2 OydpgUl76IQAp1hxnw8jvzoMIHTkDK410zf2Pl+AHLeFXnrCrutcj82wK1aLC00T5jkJ ftdQ== X-Gm-Message-State: AOJu0YyX3HYypF2c82tZWqEy4HfeMilkK6VkACF0hwxt1pQ8VCzzEJgZ Y03Z4xu2r/gMolp3Y+vgW/hZ/OZjSorgg4WhhGUYGV8pxUjxkLSOYtsEZA== X-Google-Smtp-Source: AGHT+IHzTFifQ431/JUSuPZ3sgPJE1Eaeg7Jy6RUUMTbUFP2E0jlVMlQmxRf9e6ObUrOscAXCOBfJA== X-Received: by 2002:a05:6512:10d3:b0:533:447b:94f0 with SMTP id 2adb3069b0e04-5389eee0951mr1139778e87.10.1727437165447; Fri, 27 Sep 2024 04:39:25 -0700 (PDT) Received: from laped.devtools.kamstrup.dk ([185.181.22.18]) by smtp.googlemail.com with ESMTPSA id 2adb3069b0e04-5389fd5e312sm275606e87.109.2024.09.27.04.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 04:39:25 -0700 (PDT) From: Lars Pedersen To: ptxdist@pengutronix.de Date: Fri, 27 Sep 2024 13:38:30 +0200 Message-ID: <20240927113830.415517-4-lapeddk@gmail.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20240927113830.415517-1-lapeddk@gmail.com> References: <20240927113830.415517-1-lapeddk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: [ptxdist] [PATCH 4/4] python3-yoyo-migrations: Version bump 7.3.2 -> 8.2.0 X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: Lars Pedersen Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Created patch from upstream commit to remove target depencency to setuptools(pkg_resources) in migrations.py file. See patch for details. Signed-off-by: Lars Pedersen --- ...-migrations.py-using-upstream-commit.patch | 147 ++++++++++++++++++ patches/yoyo-migrations-8.2.0/series | 4 + rules/python3-yoyo-migrations.in | 5 +- rules/python3-yoyo-migrations.make | 4 +- 4 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 patches/yoyo-migrations-8.2.0/0001-Patch-migrations.py-using-upstream-commit.patch create mode 100644 patches/yoyo-migrations-8.2.0/series diff --git a/patches/yoyo-migrations-8.2.0/0001-Patch-migrations.py-using-upstream-commit.patch b/patches/yoyo-migrations-8.2.0/0001-Patch-migrations.py-using-upstream-commit.patch new file mode 100644 index 000000000..a122a2f24 --- /dev/null +++ b/patches/yoyo-migrations-8.2.0/0001-Patch-migrations.py-using-upstream-commit.patch @@ -0,0 +1,147 @@ +From: Lars Pedersen +Date: Wed, 18 Sep 2024 09:08:44 +0000 +Subject: [PATCH] Patch migrations.py using upstream commit + +Removes dependency for setuptools (pkg_resources), since it has been deprecated + +https://hg.sr.ht/~olly/yoyo/rev/d126fcf9f094c4ce00683f664f4aa6e1c0e0c9f1 + +Signed-off-by: Lars Pedersen +--- + yoyo/migrations.py | 54 ++++++++++++++++++++++++++++-------------------------- + 1 file changed, 28 insertions(+), 26 deletions(-) + +diff --git a/yoyo/migrations.py b/yoyo/migrations.py +index 79d371d79462..cce2c0a27ed6 100755 +--- a/yoyo/migrations.py ++++ b/yoyo/migrations.py +@@ -15,23 +15,26 @@ + from collections import Counter + from collections import OrderedDict + from collections import abc ++from contextlib import ExitStack + from copy import copy + from glob import glob ++from importlib import resources + from itertools import chain + from itertools import count + from itertools import zip_longest + from logging import getLogger ++import atexit + import typing as t + import hashlib + import importlib.util + import os ++import pathlib + import re + import sys + import inspect + import types + import textwrap + +-import pkg_resources + import sqlparse + + from yoyo import exceptions +@@ -43,15 +46,16 @@ default_migration_table = "_yoyo_migration" + hash_function = hashlib.sha256 + + +-def _is_migration_file(path): ++def _is_migration_file(path: pathlib.Path): + """ + Return True if the given path matches a migration file pattern + """ + from yoyo.scripts import newmigration + +- _, extension = os.path.splitext(path) +- return extension in {".py", ".sql"} and not path.startswith( +- newmigration.tempfile_prefix ++ return ( ++ path.is_file() ++ and path.suffix in {".py", ".sql"} ++ and not path.name.startswith(newmigration.tempfile_prefix) + ) + + +@@ -133,7 +137,6 @@ def read_sql_migration( + + + class Migration(object): +- + __all_migrations: t.Dict[str, "Migration"] = {} + + def __init__(self, id, path, source_dir): +@@ -235,7 +238,6 @@ class Migration(object): + self.steps = collector.create_steps(self.use_transactions) + + def process_steps(self, backend, direction, force=False): +- + self.load() + reverse = {"rollback": "apply", "apply": "rollback"}[direction] + +@@ -280,7 +282,6 @@ class PostApplyHookMigration(Migration): + + + class StepBase(object): +- + id = None + + def __repr__(self): +@@ -359,7 +360,6 @@ class MigrationStep(StepBase): + """ + + def __init__(self, id, apply, rollback): +- + self.id = id + self._rollback = rollback + self._apply = apply +@@ -450,29 +450,31 @@ class StepGroup(MigrationStep): + + def _expand_sources(sources) -> t.Iterable[t.Tuple[str, t.List[str]]]: + package_match = re.compile(r"^package:([^\s\/:]+):(.*)$").match ++ ++ filecontext = ExitStack() ++ atexit.register(filecontext.close) ++ + for source in sources: + mo = package_match(source) + if mo: + package_name = mo.group(1) + resource_dir = mo.group(2) +- paths = [ +- pkg_resources.resource_filename( +- package_name, "{}/{}".format(resource_dir, f) +- ) +- for f in sorted( +- pkg_resources.resource_listdir(package_name, resource_dir) +- ) +- if _is_migration_file(f) +- ] +- yield (source, paths) ++ try: ++ pkg_files = resources.files(package_name).joinpath(resource_dir) ++ if pkg_files.is_dir(): ++ all_files = ( ++ filecontext.enter_context(resources.as_file(traversable)) ++ for traversable in pkg_files.iterdir() ++ if traversable.is_file() ++ ) ++ paths = [str(f) for f in sorted(all_files) if _is_migration_file(f)] ++ yield (source, paths) ++ except FileNotFoundError: ++ continue + else: +- for directory in glob(source): +- paths = [ +- os.path.join(directory, path) +- for path in os.listdir(directory) +- if _is_migration_file(path) +- ] +- yield (directory, sorted(paths)) ++ for directory in map(pathlib.Path, glob(source)): ++ paths = [str(f) for f in directory.iterdir() if _is_migration_file(f)] ++ yield (str(directory), sorted(paths)) + + + def read_migrations(*sources): diff --git a/patches/yoyo-migrations-8.2.0/series b/patches/yoyo-migrations-8.2.0/series new file mode 100644 index 000000000..fc17f510c --- /dev/null +++ b/patches/yoyo-migrations-8.2.0/series @@ -0,0 +1,4 @@ +# generated by git-ptx-patches +#tag:base --start-number 1 +0001-Patch-migrations.py-using-upstream-commit.patch +# 0df97c28ea7ab26042fc702923ff6050 - git-ptx-patches magic diff --git a/rules/python3-yoyo-migrations.in b/rules/python3-yoyo-migrations.in index d01286d0b..e90c0264d 100644 --- a/rules/python3-yoyo-migrations.in +++ b/rules/python3-yoyo-migrations.in @@ -4,9 +4,8 @@ config PYTHON3_YOYO_MIGRATIONS tristate prompt "python3-yoyo-migrations" select PYTHON3 - select PYTHON3_SETUPTOOLS - select PYTHON3_INIHERIT - select PYTHON3_TEXT_UNIDECODE + select HOST_PYTHON3_PYBUILD + select PYTHON3_IMPORTLIB_METADATA select PYTHON3_SQLPARSE select PYTHON3_TABULATE help diff --git a/rules/python3-yoyo-migrations.make b/rules/python3-yoyo-migrations.make index d6f9c3c2b..3d774424b 100644 --- a/rules/python3-yoyo-migrations.make +++ b/rules/python3-yoyo-migrations.make @@ -14,8 +14,8 @@ PACKAGES-$(PTXCONF_PYTHON3_YOYO_MIGRATIONS) += python3-yoyo-migrations # # Paths and names # -PYTHON3_YOYO_MIGRATIONS_VERSION := 7.3.2 -PYTHON3_YOYO_MIGRATIONS_MD5 := bf1f70e0198a8dae5eb78e864d545456 +PYTHON3_YOYO_MIGRATIONS_VERSION := 8.2.0 +PYTHON3_YOYO_MIGRATIONS_MD5 := 0b99c4925b14c40fcd5fe4f7c0092b0d PYTHON3_YOYO_MIGRATIONS := yoyo-migrations-$(PYTHON3_YOYO_MIGRATIONS_VERSION) PYTHON3_YOYO_MIGRATIONS_SUFFIX := tar.gz PYTHON3_YOYO_MIGRATIONS_URL := $(call ptx/mirror-pypi, yoyo-migrations, $(PYTHON3_YOYO_MIGRATIONS).$(PYTHON3_YOYO_MIGRATIONS_SUFFIX)) -- 2.46.1