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 bed0f71565c0dd344f153f6e8c9d33580cf26d21
parent f2940b5d7d0f2256a1ad68460cc7b92abbd782a4
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Wed, 11 Dec 2013 09:22:30 +0530

src/gns-deb-diff.py: new functions read_gns_readme & slurp_readmes

Diffstat:
src/gns-deb-diff.py | 45+++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+), 0 deletions(-)

diff --git a/src/gns-deb-diff.py b/src/gns-deb-diff.py @@ -91,5 +91,50 @@ def get_paraphernalia(): return packages_list + +def read_gns_readme(package): + """ + Reads & returns the README.gNewSense file for the package. + + If the README.gNewSense is not present, it returns None. + """ + + global local_dir + + try: + readme_file = open("%s/%s/debian/README.gNewSense" % (local_dir, + package), + 'r') + except IOError, e: + print "Trouble opening %s/%s" % (local_dir, package) + print e + return None # give up! + + readme_content = readme_file.read().strip() + readme_file.close() + + return readme_content + + +def slurp_readmes(package_list): + """Reads the README.gNewSense for each package in package_list. + + The readme content of all packages is put into a dict. + """ + + pkg_readmes = {} + noreadme_pkgs = [] + + for pkg in package_list: + readme_content = read_gns_readme(pkg) + + if readme_content is not None: + pkg_readmes[pkg] = readme_content + else: + noreadme_pkgs.append(pkg) + + return pkg_readmes, noreadme_pkgs + pkgs_list = get_paraphernalia() deploy_packages_locally(pkgs_list) +pkg_readmes, noreadme_pkgs = slurp_readmes(pkgs_list)