Description: Generate file with fixed template to avoid source tarball mismatches during build
Author: Gianfranco Costamagna <locutusofborg@debian.org>

Origin: https://github.com/borgbackup/borg/issues/6875
Bug-Debian: https://bugs.debian.org/1015052
Forwarded: https://github.com/borgbackup/borg/pull/6876
Last-Update: 2022-07-18

--- borgbackup-1.2.1.orig/setup.py
+++ borgbackup-1.2.1/setup.py
@@ -257,11 +257,14 @@ if not on_rtd:
         # generate C code from Cython for THIS platform (and for all platform-independent Cython parts).
         ext_modules = cythonize(ext_modules, **cython_opts)
 
-
+# make sure we have the same versioning scheme with all setuptools_scm versions, to avoid different autogenerated files
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1015052
+# https://github.com/borgbackup/borg/issues/6875
 setup(
     name='borgbackup',
     use_scm_version={
         'write_to': 'src/borg/_version.py',
+        'write_to_template': '__version__ = version = {version!r} \n__version_tuple__ = version_tuple = {version_tuple!r}',
     },
     author='The Borg Collective (see AUTHORS file)',
     author_email='borgbackup@python.org',
--- borgbackup-1.2.1.orig/src/borg/_version.py
+++ borgbackup-1.2.1/src/borg/_version.py
@@ -1,5 +1,2 @@
-# coding: utf-8
-# file generated by setuptools_scm
-# don't change, don't track in version control
-version = '1.2.1'
-version_tuple = (1, 2, 1)
+__version__ = version = '1.2.1' 
+__version_tuple__ = version_tuple = (1, 2, 1)
\ No newline at end of file
