> > > + return [
> > > + archive
> > > + for archive in distribution.all_distro_archives
> > > + if archive.purpose in ARCHIVES_TO_PUBLISH]
>
> I don't know if you like lambdas but they are not banned anymore
> AFAIK. So this could be written as:
>
> return filter(
> distribution.all_distro_archives,
> lambda archive: archive.purpose in ARCHIVES_TO_PUBLISH)
>
> But I let you decide what you find more readable. I personally do not
> prefer the dangling if clause.
Neither do I, though in this case I feel a very slight preference for the "if" because it reads so naturally.
> > > + self.distributions = distro_set.getDerivedDistributions()
>
> Should the script not say something if this list is empty? Or even
> refuse to start?
Well, there is already a check that a self.distributions has to be selected one way or the other. After that, self.distributions could only be empty if the --all-derived option was passed but there are no derived distributions.
Since this will be running from a cron job, I think we probably shouldn't be generating repeated oopses just because there's no derived distro yet. Or if all derived distros disappear from the database later, I'd like to think that we'd find out about it in other ways. :)
Refusing to start probably wouldn't do us much good: the script would iterate over zero distributions anyway.
> review approve
Thanks again. The notes one by one:
> > > === modified file 'lib/lp/ archivepublishe r/scripts/ publish_ ftpmaster. py' archivepublishe r/scripts/ publish_ ftpmaster. py archivepublishe r/scripts/ publish_ ftpmaster. py
> > > --- lib/lp/
> > > 2011-08-15 11:04:41 +0000
> > > +++ lib/lp/
> > > 2011-08-15 11:04:41 +0000
> > > @@ -31,12 +31,20 @@
> > > + return [ all_distro_ archives TO_PUBLISH] all_distro_ archives, TO_PUBLISH)
> > > + archive
> > > + for archive in distribution.
> > > + if archive.purpose in ARCHIVES_
>
> I don't know if you like lambdas but they are not banned anymore
> AFAIK. So this could be written as:
>
> return filter(
> distribution.
> lambda archive: archive.purpose in ARCHIVES_
>
> But I let you decide what you find more readable. I personally do not
> prefer the dangling if clause.
Neither do I, though in this case I feel a very slight preference for the "if" because it reads so naturally.
> > > + self.distributions = distro_ set.getDerivedD istributions( )
>
> Should the script not say something if this list is empty? Or even
> refuse to start?
Well, there is already a check that a self.distributions has to be selected one way or the other. After that, self.distributions could only be empty if the --all-derived option was passed but there are no derived distributions.
Since this will be running from a cron job, I think we probably shouldn't be generating repeated oopses just because there's no derived distro yet. Or if all derived distros disappear from the database later, I'd like to think that we'd find out about it in other ways. :)
Refusing to start probably wouldn't do us much good: the script would iterate over zero distributions anyway.
> > > === modified file archivepublishe r/tests/ test_publish_ ftpmaster. py' archivepublishe r/tests/ test_publish_ ftpmaster. py archivepublishe r/tests/ test_publish_ ftpmaster. py
> > > 'lib/lp/
> > > --- lib/lp/
> > > 2011-08-15 11:04:41 +0000
> > > +++ lib/lp/
> > > 2011-08-15 11:04:41 +0000
> > > @@ -290,6 +290,22 @@
> > > + reference_config = getPubConfig( distro. main_archive) getConfigs( )[distro] [ArchivePurpose .PRIMARY] l(reference_ config. temproot, config.temproot) l(reference_ config. distroroot, l(reference_ config. archiveroot,
> > > + config = script.
> > > + self.assertEqua
> > > + self.assertEqua
> > > config.distroroot)
> > > + self.assertEqua
> > > config.archiveroot)
>
> This is a Good Place for the MatchesStructure matcher from testtools.
Yes, it is. Kudos for spotting that it's not in testtools. matchers. __all__ (thus explaining why I didn't find it in __all__). I'll rewrite.
Jeroen