forked from openlp/openlp
Added merge proposal script; updated version style again
This commit is contained in:
parent
a6f8909d72
commit
be4795fba0
49
scripts/mp_update.py
Normal file
49
scripts/mp_update.py
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python2
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
from launchpadlib.launchpad import Launchpad
|
||||
|
||||
|
||||
def parse_args():
|
||||
"""
|
||||
Parse the command line arguments
|
||||
"""
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('-p', '--merge-proposal', required=True,
|
||||
help='The main part of the URL to the merge proposal, without the hostname.')
|
||||
parser.add_argument('-m', '--message', required=True,
|
||||
help='The comment to add to the merge proposal')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def get_merge_proposal(merge_proposal_url):
|
||||
"""
|
||||
Get the merge proposal for the ``merge_proposal_url``
|
||||
"""
|
||||
lp = Launchpad.login_with('OpenLP CI', 'production', version='devel')
|
||||
openlp_project = lp.projects['openlp']
|
||||
merge_proposals = openlp_project.getMergeProposals()
|
||||
for merge_proposal in merge_proposals:
|
||||
if str(merge_proposal).endwith(merge_proposal_url):
|
||||
return merge_proposal
|
||||
return None
|
||||
|
||||
|
||||
def create_comment(merge_proposal, comment):
|
||||
"""
|
||||
Create a comment on the merge proposal
|
||||
"""
|
||||
merge_proposal.createComment(subject='comment', content=comment)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Run the thing
|
||||
"""
|
||||
args = parse_args()
|
||||
merge_proposal = get_merge_proposal(args.merge_proposal)
|
||||
if not merge_proposal:
|
||||
print('No merge proposal with that URL found')
|
||||
sys.exit(1)
|
||||
else:
|
||||
create_comment(merge_proposal, args.message)
|
2
setup.py
2
setup.py
@ -99,7 +99,7 @@ try:
|
||||
if tree_revision == tag_revision:
|
||||
version_string = tag_version.decode('utf-8')
|
||||
else:
|
||||
version_string = '{version}-dev{revision}'.format(version=tag_version.decode('utf-8'),
|
||||
version_string = '{version}.dev{revision}'.format(version=tag_version.decode('utf-8'),
|
||||
revision=tree_revision.decode('utf-8'))
|
||||
ver_file = open(VERSION_FILE, 'w')
|
||||
ver_file.write(version_string)
|
||||
|
Loading…
Reference in New Issue
Block a user