+class VersionCheckCommand(Command):
+ """Make sure git tag and version match before uploading"""
+ user_options = []
+
+ def initialize_options(self):
+ """Abstract method that is required to be overwritten"""
+
+ def finalize_options(self):
+ """Abstract method that is required to be overwritten"""
+
+ def run(self):
+ version = self.distribution.get_version()
+ version_git = subprocess.check_output(['git', 'describe', '--tags', '--always']).rstrip().decode('utf-8')
+ if version != version_git:
+ print('ERROR: Release version mismatch! setup.py (%s) does not match git (%s)'
+ % (version, version_git))
+ sys.exit(1)
+ print('Upload using: twine upload dist/fdroidserver*.tar.gz*')
+
+