Issue1737

classification
Title: Jython 2.5.2 lacks os.major and os.minor
Type: rfe Severity: minor
Components: Library Versions: Jython 2.5
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: amak, dstromberg, irmen
Priority: low Keywords:

Created on 2011-04-19.02:14:13 by dstromberg, last changed 2013-02-19.23:58:46 by fwierzbicki.

Messages
msg6501 (view) Author: Dan Stromberg (dstromberg) Date: 2011-04-19.02:14:13
It'd be nice to have os.major and os.minor, for the backup program I'm writing.  It currently runs on CPython 2.x, CPython 3.x, PyPy 1.4.1 and recent PyPy trunks.  I'd like to add Jython 2.5.x to that list.

For now, I'm coding around their absence, but this'll make Jython a less appropriate runtime for this program.
msg6674 (view) Author: Irmen de Jong (irmen) Date: 2011-10-12.22:38:22
I think os.makedev() also belongs in this list then
msg6679 (view) Author: Alan Kennedy (amak) Date: 2011-10-15.11:51:51
Note that this information is not available from standard java.

Jython, because it has posix support, does provide access to the device number, in the st_dev field of the tuple returned from os.stat.

>>> import os
>>> st = os.stat('.')
>>> print st
(16895, 0L, 23L, 1, 0, 0, 0L, 1318677370, 1318677370, 1318677217)
>>> import stat
>>> device_number = st[stat.ST_DEV]
>>> print device_number
23L

However, extracting a major and minor device number from that device number is platform-dependent, AFAIK, meaning that the major and minor device numbers will appear in different bit positions in that device number, on different platforms.

Implementing platform-specific versions of the major and minor functions for each platform has yet been implemented on jython.

Patches welcome.
msg6680 (view) Author: Alan Kennedy (amak) Date: 2011-10-15.17:53:36
This platform variability is further confirmed by the lack of the minor() and minor() functions in cpython on windows.

>C:\Python26\python.exe
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.major
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'major'
>>> os.minor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'minor'
>>> os.makedev
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'makedev'
>>>
History
Date User Action Args
2013-02-19 23:58:46fwierzbickisetstatus: open -> closed
priority: low
resolution: wont fix
versions: + Jython 2.5, - 2.5.2rc
2011-10-15 17:53:36amaksetmessages: + msg6680
2011-10-15 11:51:51amaksetnosy: + amak
messages: + msg6679
2011-10-12 22:38:22irmensetnosy: + irmen
messages: + msg6674
2011-04-19 02:14:13dstrombergcreate