Skip to content

Instantly share code, notes, and snippets.

@sergiusens
Created July 21, 2016 08:38
Show Gist options
  • Save sergiusens/92f830789ec95a1cc194e207d29f3f88 to your computer and use it in GitHub Desktop.
Save sergiusens/92f830789ec95a1cc194e207d29f3f88 to your computer and use it in GitHub Desktop.
launchpad
#!/usr/bin/python2
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
from launchpadlib import launchpad
if len(sys.argv) != 2:
print('Usage: {} <milestone>')
sys.exit(1)
release = sys.argv[1]
cachedir = os.path.join(os.getenv('HOME'), '.launchpadlib', 'cache')
client = launchpad.Launchpad.login_with(
'snapcraft scripts', 'production', cachedir, version='devel')
ubuntu = client.distributions['ubuntu']
snapcraft = client.projects['snapcraft']
snapcraft_milestone = snapcraft.getMilestone(name=sys.argv[1])
tasks = snapcraft.searchTasks(milestone=snapcraft_milestone)
for task in tasks:
if task.status == 'Fix Commited':
print('Marking {!r} \'Fix Released\'.'.format(task.title))
task.status = 'Fix Released'
task.lp_save()
else:
print('Skipping {!r} as status is {!r}.'.format(
task.title, task.status))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment