[Bf-python] Remote IPython & PyCrust Shell for Blender

Nathan Letwory jesterking at letwory.net
Thu Apr 3 09:03:04 CEST 2008


Hi, thanks for the patches, I have marked this thread as important so
I can find it back - but I have to concentrate on getting DbBlender in
shape for the MySQL conference (
http://en.oreilly.com/mysql2008/public/schedule/detail/1806 ). After
that I can take a look. I guess I'll have to create my own build
scripts, as I don't use gnu make on the windows command-line. Anyway,
I'll investigate this when I get to it.

/Nathan

On Tue, Apr 1, 2008 at 10:26 AM, Dietrich Bollmann <diresu at web.de> wrote:
> Hi,
>
>  Me again...
>
>  I had to rename the patch after downloading it:
>
>   wget
>  http://lists.blender.org/pipermail/bf-python/attachments/20080401/dfcf0681/attachment.bin
>   mv attachment.bin getopt-exp.tar.gz
>
>  I appended a transcript of the whole process...
>
>  Dietrich
>
>  --- transcript ---
>
>  dietrich at pippi:~ $ TMP=/tmp
>  dietrich at pippi:~ $ mkdir ${TMP}/getopt
>  dietrich at pippi:~ $ cd ${TMP}/getopt
>  dietrich at pippi:/tmp/getopt $ wget
>  http://lists.blender.org/pipermail/bf-python/attachments/20080401/dfcf0681/attachment.bin
>  --2008-04-01 16:16:47--
>  http://lists.blender.org/pipermail/bf-python/attachments/20080401/dfcf0681/attachment.bin
>  Resolving lists.blender.org... 194.109.217.139
>  Connecting to lists.blender.org|194.109.217.139|:80... connected.
>  HTTP request sent, awaiting response... 200 OK
>  Length: 2561 (2.5K) [application/octet-stream]
>  Saving to: `attachment.bin'
>
>  100%[====================================================================================================>] 2,561       --.-K/s   in 0s
>
>  2008-04-01 16:16:47 (102 MB/s) - `attachment.bin' saved [2561/2561]
>
>  dietrich at pippi:/tmp/getopt $ ls -la
>  total 5
>  drwxr-xr-x  2 dietrich dietrich   80 2008-04-01 16:16 .
>  drwxrwxrwt 18 root     root      848 2008-04-01 16:16 ..
>  -rw-r--r--  1 dietrich dietrich 2561 2008-04-01 16:06 attachment.bin
>  dietrich at pippi:/tmp/getopt $ mv attachment.bin getopt-exp.tar.gz
>  dietrich at pippi:/tmp/getopt $ gunzip getopt-exp.tar.gz
>  dietrich at pippi:/tmp/getopt $ tar xvf getopt-exp.tar
>  getopt-exp/
>  getopt-exp/Makefile
>  getopt-exp/README
>  getopt-exp/getopt-exp.c
>  getopt-exp/blender-getopt.patch
>  dietrich at pippi:/tmp/getopt $ cd getopt-exp/
>  dietrich at pippi:/tmp/getopt/getopt-exp $ mkdir vendor-drop
>  dietrich at pippi:/tmp/getopt/getopt-exp $ cd vendor-drop
>  dietrich at pippi:/tmp/getopt/getopt-exp/vendor-drop $ svn export
>
> svn://gcc.gnu.org/svn/gcc/trunk/libiberty/getopt.c
>  A    getopt.c
>  Export complete.
>  dietrich at pippi:/tmp/getopt/getopt-exp/vendor-drop $ svn export
>  svn://gcc.gnu.org/svn/gcc/trunk/include/getopt.h
>  A    getopt.h
>  Export complete.
>  dietrich at pippi:/tmp/getopt/getopt-exp/vendor-drop $ cd ..
>  dietrich at pippi:/tmp/getopt/getopt-exp $ cp vendor-drop/* .
>  dietrich at pippi:/tmp/getopt/getopt-exp $ patch -p0 --ignore-whitespace <
>  blender-getopt.patch
>  patching file getopt.c
>  dietrich at pippi:/tmp/getopt/getopt-exp $ diff getopt.h
>  vendor-drop/getopt.h
>  dietrich at pippi:/tmp/getopt/getopt-exp $ diff getopt.c
>  vendor-drop/getopt.c
>  45,47c45
>  < /* uncommented for usage in blender (dietrich)
>  <   #include "ansidecl.h"
>  < */
>  ---
>  > #include "ansidecl.h"
>  dietrich at pippi:/tmp/getopt/getopt-exp $ make
>  gcc -c -o getopt.o getopt.c
>  gcc -c -o getopt-exp.o getopt-exp.c
>  gcc getopt.o getopt-exp.o -o getopt-exp
>  dietrich at pippi:/tmp/getopt/getopt-exp $ ./getopt-exp --help
>  GNU getopt() experiments :)
>
>  * dumping command line options:
>
>  - number of arguments: 1
>
>   - argv[1]: --help
>
>  * parsing the command line parameters with getopt:
>
>  usage: ./getopt-exp [options]
>
>  options:
>
>   -h | --help            - print this help message.
>   -n | --no-arg          - an option without arguments.
>   -r | --arg-required    - an option with a required argument.
>   -o | --arg-optional    - an option with an optional argument.
>
>  examples:
>
>   ./getopt-exp -h
>   ./getopt-exp --help
>   ./getopt-exp -n
>   ./getopt-exp --no-arg
>   ./getopt-exp -n --no-arg
>   ./getopt-exp -r arg1 --arg-required arg2
>   ./getopt-exp -rarg1 --arg-required=arg2
>   ./getopt-exp -o --arg-optional
>   ./getopt-exp -oarg3 --arg-optional=arg4
>
>
>   ./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
>
>  dietrich at pippi:/tmp/getopt/getopt-exp $ ./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
>  GNU getopt() experiments :)
>
>  * dumping command line options:
>
>  - number of arguments: 22
>
>   - argv[1]: one
>   - argv[2]: -n
>   - argv[3]: --no-arg
>   - argv[4]: two
>   - argv[5]: -r
>   - argv[6]: arg1
>   - argv[7]: --arg-required
>   - argv[8]: arg2
>   - argv[9]: -rarg1
>   - argv[10]: --arg-required=arg2
>   - argv[11]: three
>   - argv[12]: -o
>   - argv[13]: --arg-optional
>   - argv[14]: -oarg3
>   - argv[15]: --arg-optional=arg4
>   - argv[16]: four
>   - argv[17]: -u
>   - argv[18]: --unknown-option
>   - argv[19]: five
>   - argv[20]: -u
>   - argv[21]: --unknown-option
>   - argv[22]: six
>
>  * parsing the command line parameters with getopt:
>
>   - no-arg option found.
>   - no-arg option found.
>   - arg-required option found; arg: arg1
>   - arg-required option found; arg: arg2
>   - arg-required option found; arg: arg1
>   - arg-required option found; arg: arg2
>   - arg-optional option found; arg: (null)
>   - arg-optional option found; arg: (null)
>   - arg-optional option found; arg: arg3
>   - arg-optional option found; arg: arg4
>  ./getopt-exp: invalid option -- u
>   - unknown option `-u'.
>  ./getopt-exp: unrecognized option `--unknown-option'
>   - unknown option character `\x0'.
>  ./getopt-exp: invalid option -- u
>   - unknown option `-u'.
>  ./getopt-exp: unrecognized option `--unknown-option'
>   - unknown option character `\x0'.
>   non-option arguments: one, two, three, four, five, six.
>
>  * dumping command line options:
>
>  - number of arguments: 22
>
>   - argv[1]: -n
>   - argv[2]: --no-arg
>   - argv[3]: -r
>   - argv[4]: arg1
>   - argv[5]: --arg-required
>   - argv[6]: arg2
>   - argv[7]: -rarg1
>   - argv[8]: --arg-required=arg2
>   - argv[9]: -o
>   - argv[10]: --arg-optional
>   - argv[11]: -oarg3
>   - argv[12]: --arg-optional=arg4
>   - argv[13]: -u
>   - argv[14]: --unknown-option
>   - argv[15]: -u
>   - argv[16]: --unknown-option
>   - argv[17]: one
>   - argv[18]: two
>   - argv[19]: three
>   - argv[20]: four
>   - argv[21]: five
>   - argv[22]: six
>
>  bye...
>
>  dietrich at pippi:/tmp/getopt/getopt-exp $ cd
>  dietrich at pippi:~ $ /bin/rm -r /tmp/getopt/
>  dietrich at pippi:~ $
>
>
>
>  On Tue, 2008-04-01 at 16:06 +0900, Dietrich Bollmann wrote:
>  > 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
>
>
> > _______________________________________________
>  > Bf-python mailing list
>  > Bf-python at blender.org
>  > http://lists.blender.org/mailman/listinfo/bf-python
>
>  _______________________________________________
>  Bf-python mailing list
>  Bf-python at blender.org
>  http://lists.blender.org/mailman/listinfo/bf-python
>
>



More information about the Bf-python mailing list