[issue7450] document that os.chmod accepts an octal digit mode

2009-12-07 Thread clutchski

New submission from clutchski clutch...@gmail.com:

It would be helpful to explicitly document that os.chmod accepts octal
digit modes e.g. os.chmod(path, 0755). This is much more user friendly
than saying you must OR bit constants kept in a completely different module.

It could be argued that this change would be make the abstraction leaky,
since the values of the stat.S_I* constants could change, but in
practice, this seems unlikely.

--
assignee: georg.brandl
components: Documentation
messages: 96060
nosy: clutchski, georg.brandl
severity: normal
status: open
title: document that os.chmod accepts an octal digit mode

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7450
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Announcing fileutils, a UNIX inspired file system library

2009-12-05 Thread . clutchski
Hello!

I am happy to announce the release of
fileutilshttp://github.com/clutchski/fileutils,
a file system library inspired by classic UNIX programs like cp, mkdir and
chmod. It is an attempt to smooth out some of the rough edges in the
standard library's os and shutil modules, and create an intuitive,
convenient way of working with files.

Ok, I am going to stop blathering and let the code speak for itself. Here's
a dummy example that demonstrates what fileutils can do (click
herehttp://gist.github.com/249919for syntax highlighting).


This module demonstrates the functionality
of the fileutils library.

http://github.com/clutchski/fileutils


import fileutils

#
# Let's make some directories.
#

# You can create directories one at a time.
fileutils.mkdir('animals')

# Or many at a time, if you want.
fileutils.mkdir(['animals/birds', 'animals/reptiles'])

# Missing parent directories can be created as well.
fileutils.mkdir_p('animals/mammals/ungulates')

# Too lazy to check if a directory exists?
# Don't worry, like the *nix implementation,
# fileutils' mkdir_p is idempotent.
fileutils.mkdir_p('animals/mammals/ungulates')

#
# Let's mess around with some files.
#

# Let's create some.
fileutils.touch('animals/birds/loon')
fileutils.touch(
['animals/reptiles/turtle', 'animals/reptiles/elk'])
fileutils.touch('animals/mammals/baaji_river_dolphin')

# Whoops, an elk isn't a reptile.
# Let's move that where it belongs.
fileutils.mv('animals/reptiles/elk', 'animals/mammals/ungulates')

# It's too sad to think about extinct animals, so
# let's pretend they never existed.
fileutils.rm('animals/mammals/baaji_river_dolphin')

# Want anyone to be able to execute your elk?
# Well, go ahead and change the permissions.
fileutils.chmod('0755', 'animals/mammals/ungulates/elk')

# Let's change the ownership of some files.
fileutils.chown('apache', 'apache', 'animals/reptiles/turtle')
fileutils.chown_R('apache', 'apache', 'animals/mammals')

#
# Let's clean up and head home.
#

fileutils.rm_rf('animals')

That's it! It's on PyPi, so you can install with sudo easy_install
fileutils. Check out the source code
herehttp://github.com/clutchski/fileutils..
And 
herehttp://clutchski.tumblr.com/post/267431466/fileutils-a-unix-inspired-file-system-library-foris
a blog post detailing the library's motivation and inspiration. And as
always, if anyone has any suggestions, thoughts or comments, it'd be great
to hear from you.

Thanks and take care,
Matt

http://clutchski.tumblr.com/
http://github.com/clutchski
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


announcing Caribou: python migrations for sqlite databases

2009-11-18 Thread clutchski
check it out:

http://github.com/clutchski/caribou

feedback is much appreciated. thanks for reading.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/