Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-Flask-Migrate for openSUSE:Factory checked in at 2023-01-05 15:01:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Flask-Migrate (Old) and /work/SRC/openSUSE:Factory/.python-Flask-Migrate.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Flask-Migrate" Thu Jan 5 15:01:22 2023 rev:8 rq:1056124 version:4.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Flask-Migrate/python-Flask-Migrate.changes 2021-07-23 23:41:34.957802905 +0200 +++ /work/SRC/openSUSE:Factory/.python-Flask-Migrate.new.1563/python-Flask-Migrate.changes 2023-01-05 15:01:40.081295662 +0100 @@ -1,0 +2,22 @@ +Thu Jan 5 06:44:33 UTC 2023 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 4.0.0: + * Updates for Flask-SQLAlchemy 3.x compatiblity + * Enable type comparison and batch mode by default + * Option to rename "db" command group to a custom name + * Better handling of MetaData instances in templates + * Set options correctly when revision --autogenerate is used #463 + * Documentation section on configuring Alembic + * Upgrade build to pypy-3.9 + * Add Python 3.10 to build + * Add Python 3.11 to build + * Specify license in project metadata #489 + * Added list-templates command and support for custom templates + * Alembic templates for aioflask + * Improved project structure +- Add patch add-custom-template.patch, include custom template so the + testsuite passes. +- Remove Python 2 gubbins. +- Switch to %pyunittest macro for running the testsuite. + +------------------------------------------------------------------- Old: ---- Flask-Migrate-3.0.1.tar.gz New: ---- Flask-Migrate-4.0.0.tar.gz add-custom-template.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Flask-Migrate.spec ++++++ --- /var/tmp/diff_new_pack.00mDZK/_old 2023-01-05 15:01:40.649299720 +0100 +++ /var/tmp/diff_new_pack.00mDZK/_new 2023-01-05 15:01:40.657299777 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-Flask-Migrate # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,22 +16,19 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without python2 Name: python-Flask-Migrate -Version: 3.0.1 +Version: 4.0.0 Release: 0 Summary: SQLAlchemy database migrations for Flask applications using Alembic License: MIT URL: https://github.com/miguelgrinberg/flask-migrate/ Source: https://files.pythonhosted.org/packages/source/F/Flask-Migrate/Flask-Migrate-%{version}.tar.gz +# Filed as gh#miguelgrinberg/Flask-Migrate#501 +Patch0: add-custom-template.patch BuildRequires: %{python_module Flask >= 0.9} BuildRequires: %{python_module Flask-SQLAlchemy >= 1.0} BuildRequires: %{python_module alembic >= 0.7} BuildRequires: %{python_module setuptools} -%if %{with python2} -BuildRequires: python-pathlib -%endif BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-Flask >= 0.9 @@ -46,7 +43,7 @@ as command line arguments for Flask-Script. %prep -%setup -q -n Flask-Migrate-%{version} +%autosetup -p1 -n Flask-Migrate-%{version} %build %python_build @@ -56,9 +53,7 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -export LC_CTYPE=en_US.UTF-8 -export PYTHONDONTWRITEBYTECODE=1 -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m unittest discover -v +%pyunittest -v %files %{python_files} %doc README.md ++++++ Flask-Migrate-3.0.1.tar.gz -> Flask-Migrate-4.0.0.tar.gz ++++++ ++++ 3219 lines of diff (skipped) ++++++ add-custom-template.patch ++++++ Index: Flask-Migrate-4.0.0/tests/custom_template/alembic.ini.mako =================================================================== --- /dev/null +++ Flask-Migrate-4.0.0/tests/custom_template/alembic.ini.mako @@ -0,0 +1,50 @@ +# Custom template + +[alembic] +# template used to generate migration files +# file_template = %%(rev)s_%%(slug)s + +# set to 'true' to run the environment during +# the 'revision' command, regardless of autogenerate +# revision_environment = false + + +# Logging configuration +[loggers] +keys = root,sqlalchemy,alembic,flask_migrate + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = WARN +handlers = console +qualname = + +[logger_sqlalchemy] +level = WARN +handlers = +qualname = sqlalchemy.engine + +[logger_alembic] +level = INFO +handlers = +qualname = alembic + +[logger_flask_migrate] +level = INFO +handlers = +qualname = flask_migrate + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(levelname)-5.5s [%(name)s] %(message)s +datefmt = %H:%M:%S Index: Flask-Migrate-4.0.0/tests/custom_template/env.py =================================================================== --- /dev/null +++ Flask-Migrate-4.0.0/tests/custom_template/env.py @@ -0,0 +1,92 @@ +# Custom template +from __future__ import with_statement + +import logging +from logging.config import fileConfig + +from flask import current_app + +from alembic import context + +# this is the Alembic Config object, which provides +# access to the values within the .ini file in use. +config = context.config + +# Interpret the config file for Python logging. +# This line sets up loggers basically. +fileConfig(config.config_file_name) +logger = logging.getLogger('alembic.env') + +# add your model's MetaData object here +# for 'autogenerate' support +# from myapp import mymodel +# target_metadata = mymodel.Base.metadata +config.set_main_option( + 'sqlalchemy.url', + str(current_app.extensions['migrate'].db.get_engine().url).replace( + '%', '%%')) +target_metadata = current_app.extensions['migrate'].db.metadata + +# other values from the config, defined by the needs of env.py, +# can be acquired: +# my_important_option = config.get_main_option("my_important_option") +# ... etc. + + +def run_migrations_offline(): + """Run migrations in 'offline' mode. + + This configures the context with just a URL + and not an Engine, though an Engine is acceptable + here as well. By skipping the Engine creation + we don't even need a DBAPI to be available. + + Calls to context.execute() here emit the given string to the + script output. + + """ + url = config.get_main_option("sqlalchemy.url") + context.configure( + url=url, target_metadata=target_metadata, literal_binds=True + ) + + with context.begin_transaction(): + context.run_migrations() + + +def run_migrations_online(): + """Run migrations in 'online' mode. + + In this scenario we need to create an Engine + and associate a connection with the context. + + """ + + # this callback is used to prevent an auto-migration from being generated + # when there are no changes to the schema + # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html + def process_revision_directives(context, revision, directives): + if getattr(config.cmd_opts, 'autogenerate', False): + script = directives[0] + if script.upgrade_ops.is_empty(): + directives[:] = [] + logger.info('No changes in schema detected.') + + connectable = current_app.extensions['migrate'].db.get_engine() + + with connectable.connect() as connection: + context.configure( + connection=connection, + target_metadata=target_metadata, + process_revision_directives=process_revision_directives, + **current_app.extensions['migrate'].configure_args + ) + + with context.begin_transaction(): + context.run_migrations() + + +if context.is_offline_mode(): + run_migrations_offline() +else: + run_migrations_online() Index: Flask-Migrate-4.0.0/tests/custom_template/script.py.mako =================================================================== --- /dev/null +++ Flask-Migrate-4.0.0/tests/custom_template/script.py.mako @@ -0,0 +1,25 @@ +# Custom template +"""${message} + +Revision ID: ${up_revision} +Revises: ${down_revision | comma,n} +Create Date: ${create_date} + +""" +from alembic import op +import sqlalchemy as sa +${imports if imports else ""} + +# revision identifiers, used by Alembic. +revision = ${repr(up_revision)} +down_revision = ${repr(down_revision)} +branch_labels = ${repr(branch_labels)} +depends_on = ${repr(depends_on)} + + +def upgrade(): + ${upgrades if upgrades else "pass"} + + +def downgrade(): + ${downgrades if downgrades else "pass"} Index: Flask-Migrate-4.0.0/tests/custom_template/README =================================================================== --- /dev/null +++ Flask-Migrate-4.0.0/tests/custom_template/README @@ -0,0 +1 @@ +Custom template.