Hello, Am Donnerstag, 27. Februar 2014 schrieb Jamie Strandboge: > On 02/27/2014 02:04 PM, Christian Boltz wrote: > > Am Donnerstag, 27. Februar 2014 schrieb Jamie Strandboge: > >> On 02/26/2014 06:48 PM, Christian Boltz wrote: > >>> this patch adds recursive_print() to common.py.
> >> Is pprint not an option? > > > > Not really - I gave it a short test, but it resulted in a very long > > line. Here's the head -c1000 of pprint'ing "aa", the hasher that > > stores all profiles: ... > > That's not very readable IMHO ;-) > > > > (If there's an option to add newlines at the right[tm] place and I > > just didn't find it, please tell me ;-) > > Hmmm, pprint has formatting options; I'm not sure why they wouldn't be > working for you. From http://docs.python.org/3/library/pprint.html: > > "pprint.pprint(object, stream=None, indent=1, width=80, depth=None) > > Prints the formatted representation of object on stream, [...] It looks nice with the test data provided in the manual, but I still get one long line if I replace "stuff" with the "aa" hasher we use. Just to give you an idea how I tested: === modified file 'utils/apparmor/aa.py' --- utils/apparmor/aa.py 2014-02-26 22:41:00 +0000 +++ utils/apparmor/aa.py 2014-02-27 21:37:46 +0000 @@ -574,6 +574,11 @@ file = get_profile_filename(pname) attach_profile_data(aa, profile_data) attach_profile_data(original_aa, profile_data) + + import pprint + pp = pprint.PrettyPrinter(indent=4) + pp.pprint(aa) + if os.path.isfile(profile_dir + '/tunables/global'): if not filelist.get(file, False): filelist[file] = hasher() Then run aa-autodep $whatever and enjoy a very long line ;-) > http://stackoverflow.com/questions/8168654/python-pprint-issues > suggested using a width of '1'. That doesn't change anything, at least not with our hasher. Regards, Christian Boltz -- If Ubuntu is a Volkswagen, then OpenSUSE is a Mercedes-Benz. [http://blogs.zdnet.com/BTL/?p=8988] -- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
