
google-highly-open-participation-psf - issue #338
Add support for seven 'os' methods in Shed Skin
Download and install Shed Skin, and read the included README for usage instructions:
http://shedskin.googlecode.com
Especially read the part about how to implement libraries. Have a look at the lib/ directory for examples of several standard library module implementations.
Add support for the following functions in the 'os' module. You'll need to have experience with C and C++ to pull this off!
getpid putenv umask unsetenv chmod renames
See task #240 and #297, which are similar to this task and both completed.
Completion:
Submit a patch for each function as an attachment to this ticket, making sure it works correctly under Windows and Linux.
Task duration: please complete this task within 5 days (120 hours) of claiming it.
Comment #1
Posted on Jan 17, 2008 by Happy BirdTitle have mistake, functions instead of 'os' modules.
Comment #2
Posted on Jan 17, 2008 by Happy Camelthat's probably my fault.. let's see if I can fix it
Comment #3
Posted on Jan 19, 2008 by Happy HorseI claim this task
Comment #4
Posted on Jan 19, 2008 by Happy Horsehere is the patch for this issue:
It works without problems on my linux, I currently don't have the possbility to test it on windows platform, but I followed the way how these functions were implemented in the python core, so I think everything should work.
- six_os_meths.patch 2.82KB
Comment #5
Posted on Jan 19, 2008 by Happy HorseAnd.. in fact there are six methods, not seven ;)
Comment #6
Posted on Jan 19, 2008 by Happy Camelgood work! I marked the task completed. will test and commit your code to SVN this weekend.
if you'd like to look into a seventh method anyway, how about looking into popen*..? :)
Comment #7
Posted on Jan 19, 2008 by Happy HorseOf course, I'll do it asap ;)
Comment #8
Posted on Jan 19, 2008 by Happy HorseFor now I have only basic popen function and working only under posix. The whole thing is harder, than it seems on the first sight. I'll think about other popen functions, but they seem to be really difficult to implement.
Comment #9
Posted on Jan 19, 2008 by Happy Camelcould you summarize for me what are the difficulties?
Comment #10
Posted on Jan 19, 2008 by Happy Camel(No comment was entered for this change.)
Comment #11
Posted on Jan 19, 2008 by Happy HorseI look at the implementation of these function in python core. while popen is simple and is just a reference to the POSIX popen function, popen2,3,4 return more pipes created in nonstandard way. (python code only for posix popen2,3,4 has a bit more than 300 lines) And if we want to make it work also under windows, calling WINAPI looks horrible. For now I'll try to implement posix part of that, but it looks pretty complex.
Comment #12
Posted on Jan 19, 2008 by Happy Camelif it gets this complex, it may be better to see if there is some existing C library that we might use instead..? or maybe it would be more useful to look into some things in 'os' that may be easier to add?
Comment #13
Posted on Jan 19, 2008 by Happy HorseHere is the patch with the basic popen implementation an popen pipe type.
No, I won't give up, I like challanges. But leave me some more time. All tips and suggestions sre welcome ;)
- os_meth.patch 4.27KB
Comment #14
Posted on Jan 20, 2008 by Happy Camelif you like challenges, you've come to the right project :D
your basic popen implementation looks good, so I commited it to SVN.. thanks!
if you're interested, I added a related task to the shedskin task wiki at shedskin.googlecode.com, about rethinking/cleaning up the file implementation..
Comment #15
Posted on Feb 3, 2008 by Happy HorseSorry for a bit of delay, but I was busy with some other things. I have written popen2 as well as few other function required for that. Unfortunately, there is still a bug in popen2 implementation, so it doesn't function properly by now, I post this patch just to show some progress. I will try to make popen2 functional in near future
- popen2.diff 5.05KB
Comment #16
Posted on Feb 4, 2008 by Happy Camelgood work, thanks! really nice to see all these extra functions appear :)
btw, in execv, you use delete, but this is not necessary, as the GC will clean everything up (well, if you don't use malloc, in which case you should use gc_malloc).
btw2, as the ghop is over, maybe you can send the next patch to the shed skin discussion group? (http://shedskin.googlecode.com)
Comment #17
Posted on Feb 4, 2008 by Happy HorseOk, I have found the bug, and popen2 now works properly. Here is the patch, I'll send it also to shedskin.googlecode.com
- popen2_2.patch 5.53KB
Comment #18
Posted on Feb 4, 2008 by Happy Camelgreat, good work! I commited your patch to SVN, but without the change to lib/builtin.cpp, as this would break support for the cStringIO module. if you are interested in improving the file implementation, please consider redoing cStringIO (and possibly StringIO).. the current support for cStringIO is just a quick hack.
Status: Completed
Labels:
C
thirdparty
coding
shedskin
ClaimedBy-dev.jrx