gns-deb-diff

automate the documentation of the differences between gNewSense and Debian.
git clone git://git.ricketyspace.net/gns-deb-diff.git
Log | Files | Refs

commit 859079274081b6160aa09a55fa6a67075ff62b37
parent 981267a35e44fea8804ccf249ff89d7850f87703
Author: rsiddharth <s@ricketyspace.net>
Date:   Wed,  9 Nov 2016 04:24:07 +0000

Update `get_packages` function.

Returns list of packages for release instead of printing them out.

* gd_diff.py (get_packages): Update function.
* tests/test_gd_diff.py (test_get_packages): Update function.

Diffstat:
gd_diff.py | 7+++++--
tests/test_gd_diff.py | 7++-----
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gd_diff.py b/gd_diff.py @@ -86,7 +86,7 @@ def read_packages(pkgs_file): def get_packages(release): - """Prints out list packages for `release`. + """Return list packages for `release`. List of packages is slurped from http://bzr.savannah.gnu.org/lh/gnewsense/packages-`release` @@ -106,8 +106,11 @@ def get_packages(release): html_forest = BeautifulSoup(res.text, 'html.parser') + pkgs = [] for td in html_forest.find_all('td', class_='autcell'): - print(td.a.string.strip()) + pkgs.append(td.a.string.strip()) + + return pkgs def save_gns_readme(content, release, pkg, local_dir): diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py @@ -96,12 +96,9 @@ class TestGdDiff(object): def test_get_packages(self): - pkgs = '' - with mock.patch('sys.stdout', new=StringIO()) as output: - get_packages('parkes') - pkgs = output.getvalue() + pkgs = get_packages('parkes') - assert_equal(pkgs, 'antlr\napt\napt-setup\nautoconf\nautoconf2.59\nautoconf2.64\nbacula\nbase-files\nbase-installer\nbatik\ncairomm\ncdebootstrap\ncfitsio3\nchoose-mirror\nclaws-mail\ndb4.6\ndb4.7\ndb4.8\ndebian-cd\ndebian-edu\ndebian-installer\ndebian-installer-launcher\ndebootstrap\ndesktop-base\ndoc-linux\ndoc-linux-hr\ndoc-linux-it\ndoc-linux-ja\ndoc-linux-pl\nenscript\nepiphany-browser\nfop\nfreetype\ngalaxia\ngdm3\nglibmm2.4\ngnewsense-archive-keyring\ngnome-desktop\ngtkmm2.4\nicedove\niceweasel\nkde4libs\nkdebase\nkdebase-workspace\nkdenetwork\nkernel-wedge\nlensfun\nliferea\nlintian\nlinux-2.6\nlinux-kernel-di-amd64-2.6\nlinux-kernel-di-i386-2.6\nlinux-latest-2.6\nlive-build\nlive-config\nmeta-gnome2\nmplayer\nnet-retriever\nobjcryst-fox\nopenbox-themes\nopenjdk-6\nopenoffice.org\npangomm\nperl-tk\npkgsel\npopularity-contest\npsutils\npython-apt\nscreenlets\nsip4-qt3\nsoftware-center\ntcl8.4\ntcl8.5\ntexlive-extra\ntk8.4\ntk8.5\nupdate-manager\nvim\nwmaker\nxchat\nxdm\nxorg-server\nxserver-xorg-video-siliconmotion\nyeeloong-base\n') + assert_equal(pkgs, ['antlr', 'apt', 'apt-setup', 'autoconf', 'autoconf2.59', 'autoconf2.64', 'bacula', 'base-files', 'base-installer', 'batik', 'cairomm', 'cdebootstrap', 'cfitsio3', 'choose-mirror', 'claws-mail', 'db4.6', 'db4.7', 'db4.8', 'debian-cd', 'debian-edu', 'debian-installer', 'debian-installer-launcher', 'debootstrap', 'desktop-base', 'doc-linux', 'doc-linux-hr', 'doc-linux-it', 'doc-linux-ja', 'doc-linux-pl', 'enscript', 'epiphany-browser', 'fop', 'freetype', 'galaxia', 'gdm3', 'glibmm2.4', 'gnewsense-archive-keyring', 'gnome-desktop', 'gtkmm2.4', 'icedove', 'iceweasel', 'kde4libs', 'kdebase', 'kdebase-workspace', 'kdenetwork', 'kernel-wedge', 'lensfun', 'liferea', 'lintian', 'linux-2.6', 'linux-kernel-di-amd64-2.6', 'linux-kernel-di-i386-2.6', 'linux-latest-2.6', 'live-build', 'live-config', 'meta-gnome2', 'mplayer', 'net-retriever', 'objcryst-fox', 'openbox-themes', 'openjdk-6', 'openoffice.org', 'pangomm', 'perl-tk', 'pkgsel', 'popularity-contest', 'psutils', 'python-apt', 'screenlets', 'sip4-qt3', 'software-center', 'tcl8.4', 'tcl8.5', 'texlive-extra', 'tk8.4', 'tk8.5', 'update-manager', 'vim', 'wmaker', 'xchat', 'xdm', 'xorg-server', 'xserver-xorg-video-siliconmotion', 'yeeloong-base']) def test_save_gns_readme(self):