from os import path from shutil import copytree # Add repository root path root_path = path.abspath(path.dirname(__file__)) # Copy the addon folder from each module copytree( path.join(root_path, 'modules', 'gdcef', 'addons'), path.join(root_path, 'project', 'addons'), dirs_exist_ok=True, ) # Configure gdcef version for precompiled binaries gdcef_build = path.join(root_path, 'project', 'addons', 'gdcef', 'build.py') gdcef_lines = [] with open(gdcef_build, 'r', encoding='utf-8') as file: gdcef_lines = file.readlines() for i, line in enumerate(gdcef_lines): if not line.startswith('GITHUB_GDCEF_RELEASE'): continue gdcef_lines[i] = 'GITHUB_GDCEF_RELEASE = "0.16.1"\n' break with open(gdcef_build, 'w', encoding='utf-8') as file: file.writelines(gdcef_lines)