mirror of
https://gitlab.com/openlp/packaging.git
synced 2024-12-22 21:12:50 +00:00
Add an option for providing tag and revision to avoid using bzr.
This commit is contained in:
parent
dacbab0e4e
commit
afcc047ee3
@ -160,6 +160,8 @@ class Builder(object):
|
|||||||
parser.add_argument('--skip-translations', action='store_true', default=False,
|
parser.add_argument('--skip-translations', action='store_true', default=False,
|
||||||
help='Do NOT update the language translation files')
|
help='Do NOT update the language translation files')
|
||||||
parser.add_argument('--debug', action='store_true', default=False, help='Create a debug build')
|
parser.add_argument('--debug', action='store_true', default=False, help='Create a debug build')
|
||||||
|
parser.add_argument('--tag-override', metavar='<tag>-bzr<revision>', default=None,
|
||||||
|
help='Override tag and revision, should be in format <tag>-bzr<revision>')
|
||||||
self.add_extra_args(parser)
|
self.add_extra_args(parser)
|
||||||
self.args = parser.parse_args()
|
self.args = parser.parse_args()
|
||||||
|
|
||||||
@ -297,17 +299,20 @@ class Builder(object):
|
|||||||
"""
|
"""
|
||||||
self._print('Writing version file...')
|
self._print('Writing version file...')
|
||||||
if not self.args.release:
|
if not self.args.release:
|
||||||
# This is a development build, get the tag and revision
|
if self.args.tag_override:
|
||||||
output = self._bzr('tags', self.branch_path, err_msg='Error running bzr tags')
|
self.version = self.args.tag_override
|
||||||
lines = output.splitlines()
|
|
||||||
if len(lines) == 0:
|
|
||||||
tag = '0.0.0'
|
|
||||||
revision = '0'
|
|
||||||
else:
|
else:
|
||||||
tag, revision = lines[-1].split()
|
# This is a development build, get the tag and revision
|
||||||
output = self._bzr('log', self.branch_path, ['--line', '-r', '-1'], 'Error running bzr log')
|
output = self._bzr('tags', self.branch_path, err_msg='Error running bzr tags')
|
||||||
revision = output.split(':')[0]
|
lines = output.splitlines()
|
||||||
self.version = '{tag}-bzr{revision}'.format(tag=tag, revision=revision)
|
if len(lines) == 0:
|
||||||
|
tag = '0.0.0'
|
||||||
|
revision = '0'
|
||||||
|
else:
|
||||||
|
tag, revision = lines[-1].split()
|
||||||
|
output = self._bzr('log', self.branch_path, ['--line', '-r', '-1'], 'Error running bzr log')
|
||||||
|
revision = output.split(':')[0]
|
||||||
|
self.version = '{tag}-bzr{revision}'.format(tag=tag, revision=revision)
|
||||||
# Write the version to the version file
|
# Write the version to the version file
|
||||||
with open(os.path.join(self.dist_path, '.version'), 'w') as version_file:
|
with open(os.path.join(self.dist_path, '.version'), 'w') as version_file:
|
||||||
version_file.write(str(self.version))
|
version_file.write(str(self.version))
|
||||||
|
Loading…
Reference in New Issue
Block a user