From: <pj...@us...> - 2008-12-10 07:35:01
|
Revision: 5730 http://jython.svn.sourceforge.net/jython/?rev=5730&view=rev Author: pjenvey Date: 2008-12-10 07:34:57 +0000 (Wed, 10 Dec 2008) Log Message: ----------- hide posixy stuff when not on posix Modified Paths: -------------- trunk/jython/Lib/os.py Modified: trunk/jython/Lib/os.py =================================================================== --- trunk/jython/Lib/os.py 2008-12-10 07:09:49 UTC (rev 5729) +++ trunk/jython/Lib/os.py 2008-12-10 07:34:57 UTC (rev 5730) @@ -494,6 +494,9 @@ except: raise f = File(sys.getPath(path)) + # XXX: jna-posix implements similar link detection in + # JavaFileStat.calculateSymlink, fallback to that instead when not + # native abs_parent = f.getAbsoluteFile().getParentFile() if not abs_parent: # root isn't a link @@ -669,29 +672,6 @@ except: raise OSError(errno.EBADF, strerror(errno.EBADF)) -if _name == 'posix' and _native_posix: - def link(src, dst): - """link(src, dst) - - Create a hard link to a file. - """ - _posix.link(sys.getPath(src), sys.getPath(dst)) - - def symlink(src, dst): - """symlink(src, dst) - - Create a symbolic link pointing to src named dst. - """ - _posix.symlink(src, sys.getPath(dst)) - - def readlink(path): - """readlink(path) -> path - - Return a string representing the path to which the symbolic link - points. - """ - return _posix.readlink(sys.getPath(path)) - # Provide lazy popen*, and system objects # Do these lazily, as most jython programs don't need them, # and they are very expensive to initialize @@ -906,66 +886,89 @@ The optional second argument can specify an alternate default.""" return environ.get(key, default) -def getegid(): - """getegid() -> egid +if _name == 'posix': + def link(src, dst): + """link(src, dst) - Return the current process's effective group id.""" - return _posix.getegid() + Create a hard link to a file. + """ + _posix.link(sys.getPath(src), sys.getPath(dst)) -def geteuid(): - """geteuid() -> euid + def symlink(src, dst): + """symlink(src, dst) - Return the current process's effective user id.""" - return _posix.geteuid() + Create a symbolic link pointing to src named dst. + """ + _posix.symlink(src, sys.getPath(dst)) -def getgid(): - """getgid() -> gid + def readlink(path): + """readlink(path) -> path - Return the current process's group id.""" - return _posix.getgid() + Return a string representing the path to which the symbolic link + points. + """ + return _posix.readlink(sys.getPath(path)) -def getlogin(): - """getlogin() -> string + def getegid(): + """getegid() -> egid - Return the actual login name.""" - return _posix.getlogin() + Return the current process's effective group id.""" + return _posix.getegid() -def getpgrp(): - """getpgrp() -> pgrp + def geteuid(): + """geteuid() -> euid - Return the current process group id.""" - return _posix.getpgrp() + Return the current process's effective user id.""" + return _posix.geteuid() -def getpid(): - """getpid() -> pid + def getgid(): + """getgid() -> gid - Return the current process id.""" - return _posix.getpid() + Return the current process's group id.""" + return _posix.getgid() -def getppid(): - """getppid() -> ppid + def getlogin(): + """getlogin() -> string - Return the parent's process id.""" - return _posix.getppid() + Return the actual login name.""" + return _posix.getlogin() -def getuid(): - """getuid() -> uid + def getpgrp(): + """getpgrp() -> pgrp - Return the current process's user id.""" - return _posix.getuid() + Return the current process group id.""" + return _posix.getpgrp() -def setpgrp(): - """setpgrp() + def getppid(): + """getppid() -> ppid - Make this process a session leader.""" - return _posix.setpgrp() + Return the parent's process id.""" + return _posix.getppid() -def setsid(): - """setsid() + def getuid(): + """getuid() -> uid - Call the system call setsid().""" - return _posix.setsid() + Return the current process's user id.""" + return _posix.getuid() + def setpgrp(): + """setpgrp() + + Make this process a session leader.""" + return _posix.setpgrp() + + def setsid(): + """setsid() + + Call the system call setsid().""" + return _posix.setsid() + +def getpid(): + """getpid() -> pid + + Return the current process id.""" + return _posix.getpid() + def isatty(fileno): """isatty(fd) -> bool This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |