Introduction

Version 1.7 (2000/02/04)

The jnios module is a complete java/JNI implementation of the builtin python modules os and posix for use with version 1.0.3 and 1.1 of the JPython environment. The builtin errno module is also included in jnios.

jnios allows the original os.py and posixpath.py/ntpath.py/... from CPython, to run under JPython. The jnios module is not an attempt to implement os module functionality on top of the java platform, but is based on posixmodule.c from CPython 1.5.2 and contains exactly the same functions as the CPython os module with exactly the same semantics.

In effect you can import jnios and expect the complete set of function from the os module to be available.

fdopen() is now implemented and works. popen() is implemented but for some reason it fails to run on Windows NT. Remarks from some people (tim_one) who know Windows a lot better than I ever will, have led me to believe that a functional popen() on Win32 should not be expected.

jnios have been compiled on Windows NT 4.0 (with MS Visual C++ 5.0) and on linux (i386/g++) and solaris (sparc/gcc).

Experience with other platforms in the form of bug reports, patches and makefiles are very welcome.

Download

Installation

Installation on a Windows NT is performed by extraction the contents of the jnios-?.?.tar.gz.

For other platforms, see the Compiling section below.

Test:

  c:\jpython
  JPython 1.1alpha2 on java1.2
  Copyright 1997-1999 Corporation for National Research Initiatives
  >>> from jnios import os
  >>> dir(os)
  ['execle', 'O_TEXT', 'execv', 'lstat', 'close', 'chdir', 'altsep', '_exit', 'exe
  cvp', '__module__', 'rmdir', 'O_TRUNC', 'dup', 'open', '_Environ', 'putenv', 'ex
  ecl', 'utime', 'removedirs', 'fstat', 'times', 'execvpe', 'execlp', 'O_RDWR', 's
  ystem', 'O_WRONLY', 'read', 'curdir', 'O_BINARY', 'lseek', 'linesep', 'stat', 'e
  rror', 'pipe', 'umask', '_execvpe', '_notfound', 'execlpe', 'rename', 'sys', 'O_
  EXCL', 'strerror', 'O_CREAT', 'listdir', 'chmod', 'O_APPEND', 'UserDict', 'paths
  ep', 'path', 'write', 'O_RDONLY', 'environ', 'sep', 'pardir', 'mkdir', 'dup2', '
  remove', 'makedirs', 'renames', 'initModule', 'string', 'getcwd', 'unlink', 'def
  path', 'name', 'getpid', 'execve']
  >>>

Compiling

The compilation process is still very alpha quality. You have to been very exprienced with both JNI and CPython before trying to compile and link the dynamic loadlibrary for java. The makefile have only been truely tested under Windows NT.

The configuration used in jnios is riped off CPython 1.5.2. So you have to have a working version of the Python 1.5.2 source distribution available on your platform. After running configure in the usual way, the generated config.h file must be copied to the jnios directory..

The config.h used with MS Visual C++ that comes with Python1.5.2 is included with jnios without any modifications. The posixmodule.h include file is stolen from the top of posixmodule.c.

Documentation and links

Note

This is a early release of the software, so don't be surprised if you find an error. jnios.cpp have at one time been compile on linux and solaris, but it have only tested in Windows. Included in jnios is a copy of os.py from CPython-1.5.2 renamed to cos.py to avoid a name clash.

Contact

If you have questions or bug reports regarding this software, send them to: Finn Bock

Changes

Copyright:

  * Copyright 1999 Finn Bock.
  * Permission to use, copy and distribute this software is hereby granted,
  * provided that the above copyright notice appear in all copies and that
  * both that copyright notice and this permission notice appear in supporting
  * documentation.
  *
  * No Warranty
  * The software is provided "as is" without warranty of any kind.

Additional Copyright:

  /***********************************************************
  Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
  The Netherlands.

  All Rights Reserved

  Permission to use, copy, modify, and distribute this software and its
  documentation for any purpose and without fee is hereby granted,
  provided that the above copyright notice appear in all copies and that
  both that copyright notice and this permission notice appear in
  supporting documentation, and that the names of Stichting Mathematisch
  Centrum or CWI or Corporation for National Research Initiatives or
  CNRI not be used in advertising or publicity pertaining to
  distribution of the software without specific, written prior
  permission.

  While CWI is the initial source for this software, a modified version
  is made available by the Corporation for National Research Initiatives
  (CNRI) at the Internet address ftp://ftp.python.org.

  STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
  CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.

  ******************************************************************/

  /* POSIX module implementation */

  /* This file is also used for Windows NT and MS-Win. In that case the module
     actually calls itself 'nt', not 'posix', and a few functions are
     either unimplemented or implemented differently. The source
     assumes that for Windows NT, the macro 'MS_WIN32' is defined independent
     of the compiler used. Different compilers define their own feature
     test macro, e.g. '__BORLANDC__' or '_MSC_VER'. */

  /* See also ../Dos/dosmodule.c */