[Bf-python] Remote IPython & PyCrust Shell for Blender
Dietrich Bollmann
diresu at web.de
Tue Apr 1 09:06:25 CEST 2008
Hi Nathan,
On Fri, 2008-03-28 at 11:38 +0200, Nathan Letwory wrote:
> On Thu, Mar 27, 2008 at 11:50 AM, Dietrich Bollmann <diresu at web.de> wrote:
>
> > - I could write a simple patch which starts to move the blender
> > option parsing code to GNU getopt().
> > I thing GNU getopt() would be a better option as it goes with the
> > current "best practise" in the c developer community and would
> > make it easy to profit from further development of the GNU
> > getopt() library.
>
> This is feasible only if it is cross-platform and cross-compiler, ie.
> it should also compile with MSVC. I haven't researched the GNU
> getopt() library though, but ideally it should be available as small
> library that we can add to lib/windows if we were to use GNU getopt().
I appended a tarball with a README explaining how to download the getopt
sources and an example file to experiment with GNU getopt().
Unfortunately I only use Linux, so I can't verify if the example works
for MAC and microsoft. But maybe you or some other person could help
out?
Everything - downloading the sources, building and playing with the
example - should only take some minutes.
If everything works I could write an example patch for Blender
implementing something like a --hello-world option. If this works fine I
could write more patches porting the option parsing code to GNU getopt()
step by step.
Best wishes, Dietrich
PS: Should I rather send this message to some other group?
Here how to use the tarball from a unix bash shell:
Use some directory for temporary files - in my case:
TMP=/tmp
# make a directory to experiment with getopt:
mkdir ${TMP}/getopt
cd ${TMP}/getopt
# unpack the attached sources:
gunzip getopt-exp.tar.gz
tar xvf getopt-exp.tar
cd getopt-exp/
# continue as described in the README file
cat README
# --- README ---
* getopt docs
- http://www.gnu.org/software/libtool/manual/libc/Getopt.html
* usage
# make a directory for the original files and download GNU getopt.{c,h}
mkdir vendor-drop
cd vendor-drop
svn export svn://gcc.gnu.org/svn/gcc/trunk/libiberty/getopt.c
svn export svn://gcc.gnu.org/svn/gcc/trunk/include/getopt.h
cd ..
# make blender versions of getopt.* and patch them for usage with
blender
cp vendor-drop/* .
patch -p0 --ignore-whitespace < blender-getopt.patch
# having a look on the differences between original version and blender
versions
# (only the line '#include "ansidecl.h"' was uncommented...)
diff getopt.h vendor-drop/getopt.h
diff getopt.c vendor-drop/getopt.c
# build getopt-exp
# the Makefile has to be edited for windows and mac...
# please post the result if working :)
make
# get usage information
./getopt-exp --help
# play with GNU getopt()
./getopt-exp \
one \
-n --no-arg \
two \
-r arg1 --arg-required arg2 -rarg1 --arg-required=arg2 \
three \
-o --arg-optional -oarg3 --arg-optional=arg4 \
four \
-u --unknown-option \
five \
-u --unknown-option \
six
* fin.
> /Nathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getopt-exp.tar.gz
Type: application/x-compressed-tar
Size: 2561 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20080401/dfcf0681/attachment.bin>
More information about the Bf-python
mailing list