1# Copyright 2013 The Distro Tracker Developers 

2# See the COPYRIGHT file at the top-level directory of this distribution and 

3# at https://deb.li/DTAuthors 

4# 

5# This file is part of Distro Tracker. It is subject to the license terms 

6# in the LICENSE file found in the top-level directory of this 

7# distribution and at https://deb.li/DTLicense. No part of Distro Tracker, 

8# including this file, may be copied, modified, propagated, or distributed 

9# except according to the terms contained in the LICENSE file. 

10"""Implements a command to update available pseudo packages.""" 

11from django.core.management.base import BaseCommand 

12 

13from distro_tracker.core.models import PseudoPackageName 

14from distro_tracker.core.retrieve_data import update_pseudo_package_list 

15 

16 

17class Command(BaseCommand): 

18 """ 

19 A Django management command which performs the update of available pseudo 

20 packages. 

21 """ 

22 help = "Update the available pseudo packages" # noqa 

23 

24 def handle(self, *args, **kwargs): 

25 verbose = int(kwargs['verbosity']) > 1 

26 if verbose: 26 ↛ 27line 26 didn't jump to line 27, because the condition on line 26 was never true

27 self.stdout.write('Retrieving new list of pseudo-packages...') 

28 

29 update_pseudo_package_list() 

30 

31 if verbose: 31 ↛ 32line 31 didn't jump to line 32, because the condition on line 31 was never true

32 self.stdout.write("The updated list of pseudo-packages is:") 

33 for package in PseudoPackageName.objects.all(): 

34 self.stdout.write('- ' + str(package))