From 765f02edc7323417a8626ee6e5eb0c527af75342 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Fri, 8 Mar 2019 18:09:11 -0600 Subject: [PATCH] Put the argument-based code in the __init__ for the function. --- ci/lp_check.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/ci/lp_check.py b/ci/lp_check.py index 145affc..81d353f 100755 --- a/ci/lp_check.py +++ b/ci/lp_check.py @@ -22,6 +22,20 @@ from launchpadlib.launchpad import Launchpad class LaunchpadCheck: + def __init__(self): + parser = argparse.ArgumentParser() + parser.add_argument("-p", "--package", help="The source package", + required=True) + parser.add_argument("-v", "--package-version", help="The package version", + required=True) + parser.add_argument("-t", "--lp-team", help="Launchpad user with the PPA", + required=True) + parser.add_argument("-r", "--ppa", help="Name of the Launchpad PPA", + required=True) + args = parser.parse_args() + self.lp_person = args.lp_team + self.ppa_name = args.ppa + def login(self): """Log in to Launchpad anonymously""" lp = Launchpad.login_anonymously("CI Infrastructure", "production", @@ -105,18 +119,5 @@ class LaunchpadCheck: raise ValueError("Timed out, contact Launchpad admins") if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("-p", "--package", help="The source package", - required=True) - parser.add_argument("-v", "--package-version", help="The package version", - required=True) - parser.add_argument("-t", "--lp-team", help="Launchpad user with the PPA", - required=True) - parser.add_argument("-r", "--ppa", help="Name of the Launchpad PPA", - required=True) - args = parser.parse_args() - self.lp_person = args.lp_team - self.ppa_name = args.ppa - lpcheck = LaunchpadCheck() lpcheck.verify_binaries_published()