Update copyright, fix a few trivial things I learned were good practice when coding with Python more

This commit is contained in:
Simon Quigley 2016-08-23 00:53:06 -05:00
parent f8235208f9
commit d39184d624
2 changed files with 17 additions and 10 deletions

View File

@ -7,7 +7,7 @@ You need the following Python libraries.
2. launchpadlib
Mass package bug subscription adder for Ubuntu Packages using the Launchpad API
Copyright (C) 2015 Simon Quigley
Copyright (C) 2015, 2016 Simon Quigley
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License

25
main.py
View File

@ -1,18 +1,25 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import launchpadlib
from launchpadlib.launchpad import Launchpad
def no_credential():
print("Can't proceed without Launchpad credentials.")
sys.exit()
print("Can't proceed without Launchpad credentials.")
sys.exit()
lp = Launchpad.login_with('Mass package bug subscription adder', 'production', credential_save_failed=no_credential)
teamtowrite = (raw_input('What person/team would you like to use for this(ID not full name)? '))
filepath = (raw_input('Please specify the path of the input file: '))
with open(filepath, "r") as ins:
filearray = []
for line in ins:
filearray.append(line.strip())
filearray = []
for line in ins:
filearray.append(line.strip())
for i in range(len(filearray)):
print("Assigning:")
print(filearray[i])
lp.distributions['ubuntu'].getSourcePackage(name=filearray[i]).addBugSubscription(subscriber=lp.people[teamtowrite])
print("Complete")
print("Assigning:")
print(filearray[i])
lp.distributions['ubuntu'].getSourcePackage(name=filearray[i]).addBugSubscription(subscriber=lp.people[teamtowrite])
print("Complete")