- dist_po_dir = os.path.join(dist_root, 'po')
- shutil.copy2(pot_src, dist_po_dir)
+
+ # Dist pot file in tarball, and fix up version in POT file to match
+ # Translation Project requirements as part of the copying.
+ with open(pot_src, 'r') as f:
+ pot_file = f.read()
+
+ pot_file = pot_file.replace(f'Project-Id-Version: {module}-1.0',
+ f'Project-Id-Version: {module}-{project_version}', 1)
+
+ print('Copying pot file into dist staging directory ...')
+ dist_pot_with_suffix = os.path.join(dist_root, 'po', f'{module}-1.0.pot')
+ with open(dist_pot_with_suffix, 'w') as f:
+ f.write(pot_file)
+
+ # And another copy without the 1.0 suffix
+ dist_pot_without_suffix = os.path.join(dist_root, 'po', f'{module}.pot')
+ with open(dist_pot_without_suffix, 'w') as f:
+ f.write(pot_file)