[Bf-committers] Scripts repository

Willian Padovani Germano bf-committers@blender.org
Wed, 21 Jan 2004 14:36:36 -0200


----- Original Message -----
From: "Douglas Bischoff" <bischofftep@mac.com>
To: <bf-committers@blender.org>
Sent: Wednesday, January 21, 2004 12:06 PM


> There are a few things which can be done to make scripts truly
> cross-platform. The main things that spring to mind have to do with
> os.sep and the like to determine the proper OS separator for building
> paths, etc.

Hi Douglas,  thanks for pointing this.  My opinion is that we should
work for all scripts to be cross-platform, it's Python after all.

About the dir separator, there's this old piece of code at
blender/python/api2_2x/Sys.c , the Blender.sys module:

#ifdef WIN32
  sep = Py_BuildValue("s", "\\");
#else
  sep = Py_BuildValue("s", "/");
#endif

it sets both Blender.sys.sep and Blender.sys.dirsep to '\' under Windows
systems and '/' everywhere else.  Doesn't this work for OS X (remember
from long ago that Apple used ':' or something, but OS X is a *nix,
isn't it?) or some other platform?

If it doesn't, we can trivially update the code, just tell us.
Confirming with a simple test now, Python under Windows accepts '/', the
only problem is the drive letter (ex: "c:"), which is required.

But your point reminds me of another: some scripts require full Python
installations, others do not.  This is also something that will need a
little more research, to see if they really need more than basic
Blender -- simple missing functionality can always be added to BPython.
The return of the file selector made standard pymodule 'os' not
necessary for scripts that only wanted that functionality, for example.
BTW, use of the file selector probably solves most issues with correct
path names, anyway.

> Can a few simple guidelines be established which a script must adhere
> to in order to be "standard fare?"

Again, my opinion is that we should only have cross-platform ones in
Blender's own package and also stimulate this goal for the others,
possibly writing a simple guide to help script writers.  Experienced
script writers can help us finding out about compatibility issues.

--
Willian, wgermano@ig.com.br