On 24/06/2008, Eirik Schwenke [EMAIL PROTECTED] wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Noah Kantrowitz skrev 24-06-2008 14:13:
| On Jun 24, 2008, at 6:03 AM, Eirik Schwenke wrote:
| Noah Kantrowitz skrev 23-06-2008 21:56:
| On Jun 23, 2008, at 3:54 PM, Noah Kantrowitz wrote:
| On Jun 23, 2008, at 3:41 PM, Eirik Schwenke wrote:
| Noah Kantrowitz skrev 23-06-2008 16:54:
| On Jun 23, 2008, at 5:28 AM, Jani Tiainen wrote:
(... tidying up a bit ...)
#posix shell solution - noah
for f in `ls /var/trac`
do
~ echo -e '\n[inherit]\nfile = /usr/share/trac/conf/trac.ini\n'\
~var/trac/$f
done
| [D]oes anyone know of a reasonable package that would
| allow asimilarly short example in python, that remained somewhat
| portable ?
|
| I'm not looking for something like ipython, the defunct pysh or
| pythonShell --
| just some helpful filesystem iterators that aren't quite as
| verbose as os.path.*
(...)
| import os
|
| for root, files, dirs in os.walk(/var/trac):
| ~ for file in files:
| ~if file.lower() == trac.ini:
| ~ with open(os.path.join(root,file), a) as f:
| ~f.writelines([[inherit], blah=something])
|
|
(...)
| Still a python find-module seems like a good (and pretty simple) idea.
|
| See `iwalk | filter`.
I did have a look at ipipe (http://ipython.scipy.org/moin/UsingIPipe), but
in
some ways i think it's the wrong solution to the right problem.
While borrowing syntax from the shell might be a nice fit for working from
within ipython - it feels a bit bolted on -- especially when working from
say
an install script.
I'm perfectly happy using bash, awk, grep and find on the command line --
and
ipython is a fine python debug/eval/test-tool; but adding that interface to
python directly leads down the path to perl IMNHO.
Python already has list comprehensions, map, lamda and filter -- I'd much
rather have a first rate object/graph mapping of the filesystem in a way
that
feels natural to standard python, than a half-baked shell meta-language
(not
that there's anything wrong with a half-baked meta-languages in and of
themselves, but I'd rather have one obvious and suitably lazy way to do
things,
while still being readable :-)
Anyway, thanks for all the input -- I'll leave this alone until I get around
to
implementing a correct solution ;-)
Best regards,
- --
~ .---. Eirik Schwenke [EMAIL PROTECTED]
( NSD ) Harald HÃ¥rfagresgate 29Rom 150
~ '---' N-5007 Bergentlf: (555) 889 13
~ GPG-key at pgp.mit.edu Id 0x8AA3392C
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIYQNkxUW7FIqjOSwRAlx2AJ4qe5lqtrm6AI9E/11bVrKHnopd0wCgknKA
X2IVJyBlS700wh6ybC0rcR0=
=XRxi
-END PGP SIGNATURE-
--
cheers,
-ambrose
The 'net used to be run by smart people; now many sites are run by
idiots. So SAD... (Sites that do spam filtering on mails sent to the
abuse contact need to be cut off the net...)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Trac
Users group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en
-~--~~~~--~~--~--~---