check git is on correct tag before making a release
This commit is contained in:
parent
ff5717b37e
commit
875dfd0d60
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
|
# uploading here requires Python 3.5.3+ or setuptools 27+,
|
||||||
|
# use instead: twine upload dist/fdroidserver*.tar.gz*
|
||||||
[aliases]
|
[aliases]
|
||||||
release = register compile_catalog sdist upload --sign
|
release = versioncheck register compile_catalog sdist upload --sign
|
||||||
|
|
||||||
# All this below is for Babel config. Ideally we would only use
|
# All this below is for Babel config. Ideally we would only use
|
||||||
# Babel, but it is still missing some key features that gettext gives
|
# Babel, but it is still missing some key features that gettext gives
|
||||||
|
|
22
setup.py
22
setup.py
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from setuptools import Command
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -7,6 +8,26 @@ import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
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*')
|
||||||
|
|
||||||
|
|
||||||
def get_data_files():
|
def get_data_files():
|
||||||
# workaround issue on OSX or --user installs, where sys.prefix is not an installable location
|
# workaround issue on OSX or --user installs, where sys.prefix is not an installable location
|
||||||
if os.access(sys.prefix, os.W_OK | os.X_OK):
|
if os.access(sys.prefix, os.W_OK | os.X_OK):
|
||||||
|
@ -56,6 +77,7 @@ setup(name='fdroidserver',
|
||||||
scripts=['fdroid', 'fd-commit', 'makebuildserver'],
|
scripts=['fdroid', 'fd-commit', 'makebuildserver'],
|
||||||
data_files=get_data_files(),
|
data_files=get_data_files(),
|
||||||
python_requires='>=3.4',
|
python_requires='>=3.4',
|
||||||
|
cmdclass={'versioncheck': VersionCheckCommand},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'clint',
|
'clint',
|
||||||
'GitPython',
|
'GitPython',
|
||||||
|
|
Loading…
Reference in New Issue