From 466a522966f8109c46644ad1fd5780ec39bb85ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 1 Jan 2023 10:53:24 +0100 Subject: [PATCH] Support Python version without root_dir argument for glob.glob root_dir argument has been added since Python 3.10 --- .hooks/link_modules | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.hooks/link_modules b/.hooks/link_modules index 2f3f806202..c7c469f1ae 100755 --- a/.hooks/link_modules +++ b/.hooks/link_modules @@ -11,7 +11,13 @@ source = os.path.join(root, 'modules') destination = os.path.join(root, 'trytond', 'trytond', 'modules') modules = set() -for filename in glob.glob('modules/*/setup.py', root_dir=root): +try: + filenames = glob.glob('modules/*/setup.py', root_dir=root) +except TypeError: + # If root_dir is not supported, fallback considering the hook is executed + # from the repository root + filenames = glob.glob('modules/*/setup.py') +for filename in filenames: modules.add(os.path.basename(os.path.dirname(filename))) for module in modules: