From f03ebd05bd0541790e58b42d41eb1de7fac2c890 Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Wed, 21 Feb 2024 13:28:34 -0500 Subject: [PATCH] Accommodate cookiecutter==2.6.0 - The 2.6.0 release of cookiecutter changes the way newlines are handled and causing black to fail for rolled out templates. - To avoid different behavior, the minimum version was bumped to 2.6.0. --- pyproject.toml | 2 +- src/briefcase/bootstraps/pursuedpybear.py | 3 +-- src/briefcase/bootstraps/pygame.py | 3 +-- src/briefcase/bootstraps/pyside6.py | 3 +-- src/briefcase/bootstraps/toga.py | 6 ++---- tests/commands/new/test_build_context.py | 21 +++++++-------------- 6 files changed, 13 insertions(+), 25 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0d87bcc0b..1df796e93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,7 @@ dependencies = [ # cause API breakages). If the package uses calver, we don't pin the upper # version, as the upper version provides no basis for determining API # stability. - "cookiecutter >= 2.3.1, < 3.0", + "cookiecutter >= 2.6.0, < 3.0", "dmgbuild >= 1.6, < 2.0; sys_platform == 'darwin'", "GitPython >= 3.1, < 4.0", "platformdirs >= 2.6, < 5.0", diff --git a/src/briefcase/bootstraps/pursuedpybear.py b/src/briefcase/bootstraps/pursuedpybear.py index ae61847ca..479dbef50 100644 --- a/src/briefcase/bootstraps/pursuedpybear.py +++ b/src/briefcase/bootstraps/pursuedpybear.py @@ -44,8 +44,7 @@ def main(): ppb.run( starting_scene={{ cookiecutter.class_name }}, title=metadata["Formal-Name"], - ) -""" + )""" def pyproject_table_briefcase_app_extra_content(self): return """ diff --git a/src/briefcase/bootstraps/pygame.py b/src/briefcase/bootstraps/pygame.py index 3e5f87e4e..14c44241e 100644 --- a/src/briefcase/bootstraps/pygame.py +++ b/src/briefcase/bootstraps/pygame.py @@ -54,8 +54,7 @@ def main(): screen.fill(WHITE) pygame.display.flip() - pygame.quit() -""" + pygame.quit()""" def pyproject_table_briefcase_app_extra_content(self): return """ diff --git a/src/briefcase/bootstraps/pyside6.py b/src/briefcase/bootstraps/pyside6.py index e8dbcbeea..92a93ee7d 100644 --- a/src/briefcase/bootstraps/pyside6.py +++ b/src/briefcase/bootstraps/pyside6.py @@ -41,8 +41,7 @@ def main(): app = QtWidgets.QApplication(sys.argv) main_window = {{ cookiecutter.class_name }}() - sys.exit(app.exec()) -""" + sys.exit(app.exec())""" def pyproject_table_briefcase_app_extra_content(self): return """ diff --git a/src/briefcase/bootstraps/toga.py b/src/briefcase/bootstraps/toga.py index 4305f0ed1..0c2ead579 100644 --- a/src/briefcase/bootstraps/toga.py +++ b/src/briefcase/bootstraps/toga.py @@ -25,16 +25,14 @@ def startup(self): def main(): - return {{ cookiecutter.class_name }}() -''' + return {{ cookiecutter.class_name }}()''' def app_start_source(self): return """\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": - main().main_loop() -""" + main().main_loop()""" def pyproject_table_briefcase_app_extra_content(self): return """ diff --git a/tests/commands/new/test_build_context.py b/tests/commands/new/test_build_context.py index 8911dc32a..2411bfc88 100644 --- a/tests/commands/new/test_build_context.py +++ b/tests/commands/new/test_build_context.py @@ -83,14 +83,12 @@ def startup(self): def main(): - return {{ cookiecutter.class_name }}() -''', + return {{ cookiecutter.class_name }}()''', app_start_source="""\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": - main().main_loop() -""", + main().main_loop()""", pyproject_table_briefcase_app_extra_content=""" requires = [ @@ -331,8 +329,7 @@ def main(): app = QtWidgets.QApplication(sys.argv) main_window = {{ cookiecutter.class_name }}() - sys.exit(app.exec()) -""", + sys.exit(app.exec())""", pyproject_table_briefcase_app_extra_content=""" requires = [ @@ -516,8 +513,7 @@ def main(): ppb.run( starting_scene={{ cookiecutter.class_name }}, title=metadata["Formal-Name"], - ) -""", + )""", pyproject_table_briefcase_app_extra_content=""" requires = [ @@ -707,8 +703,7 @@ def main(): screen.fill(WHITE) pygame.display.flip() - pygame.quit() -""", + pygame.quit()""", pyproject_table_briefcase_app_extra_content=""" requires = [ @@ -1074,14 +1069,12 @@ def startup(self): def main(): - return {{ cookiecutter.class_name }}() -''', + return {{ cookiecutter.class_name }}()''', app_start_source="""\ from {{ cookiecutter.module_name }}.app import main if __name__ == "__main__": - main().main_loop() -""", + main().main_loop()""", pyproject_table_briefcase_app_extra_content=""" requires = [