Opened 11 years ago

Closed 10 years ago

#2881 defect closed fixed (fixed)

Add a variable in twisted.python.runtime to check for vista

Reported by: Michael Schneider Owned by:
Priority: high Milestone:
Component: core Keywords:
Cc: Glyph Branch: branches/vista-2881
branch-diff, diff-cov, branch-cov, buildbot
Author: therve

Description (last modified by therve)

os.name returns 'nt' and sys.platform returns 'win32', so it's impossible to differentiate vista from XP with that. Maybe we could extract the information from platform.uname()[3] (whose value is '6.0.6000' in vista).

See the related bug in Python here: http://bugs.python.org/issue1082.

Attachments (1)

2881.diff (1.3 KB) - added by therve 10 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 11 years ago by therve

Description: modified (diff)

comment:2 Changed 11 years ago by therve

Description: modified (diff)
Owner: changed from Glyph to therve
Summary: twisted.python.runtime patch error in 2.5..0 and .1 for platform type for vistaAdd a variable in twisted.python.runtime to check for vista

comment:3 Changed 11 years ago by Glyph

I am sorely tempted to close this as invalid. Why does anyone ever need to know the difference between XP and Vista using Twisted? This seems to me like modifying twisted.python.runtime to have different values to check for Ubuntu 6.06 vs. 7.10. The only consequence I can see is adding a new way for code to ask "is this a windows machine" that will succeed on XP but fail on Vista (or vice versa). Shouldn't we leave platform detection of this granularity up to the code which will actually care? i.e. if you are asking if it's Vista because Vista has a new or changed win32 function, shouldn't you be asking the win32 wrapper?

If Twisted needs to make this determination for its own purposes, then this makes sense to me. Is Twisted going to be making different API calls on Vista and XP? If not, I'd like to consider them the same platform.

comment:4 Changed 11 years ago by therve

Cc: Glyph added

Again, sorry for not being clear, I'm the one who asked for that. This may be something we want because vista UDP implementation is significantly different from XP one (for example, test_joinFailure seems to pass under vista).

Changed 10 years ago by therve

Attachment: 2881.diff added

comment:5 Changed 10 years ago by therve

author: therve
Branch: branches/vista-2881

(In [23533]) Branching to 'vista-2881'

comment:6 Changed 10 years ago by therve

Keywords: review added
Owner: therve deleted

OK this is ready to review. This branch is green under my vista instance. I also realized that buildbot wrongly reports successful build when we have unexpected success (like on the windows 2008 slave).

comment:7 Changed 10 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to therve

Looks good, please merge.

comment:8 Changed 10 years ago by therve

Resolution: fixed
Status: newclosed

(In [23691]) Merge vista-2881

Author: therve Reviewer: exarkun Fixes #2881

Add twisted.python.runtime.Platform.isVista: this method is used to differentiate Vista/Server 2008 from previous Windows versions. This is first used to change a Multicast test from todo to pass.

comment:9 Changed 10 years ago by therve

Resolution: fixed
Status: closedreopened

(In [23693]) Revert r23691: regressions under OS X. Some failures like that:

[ERROR]: twisted.python.test.test_runtime.PlatformTests.test_isVistaConsistency

Traceback (most recent call last):
  File "/Users/buildbot/Run/buildbot/full2.5-exarkun-osx/Twisted/twisted/python/test/test_runtime.py", line 26, in test_isVistaConsistency
    if platform.isVista():
  File "/Users/buildbot/Run/buildbot/full2.5-exarkun-osx/Twisted/twisted/python/runtime.py", line 85, in isVista
    uname = platform.uname()
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/platform.py", line 1014, in uname
    processor = _syscmd_uname('-p','')
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/platform.py", line 800, in _syscmd_uname
    output = string.strip(f.read())
exceptions.IOError: [Errno 4] Interrupted system call

Reopens #2881

comment:10 Changed 10 years ago by therve

(In [23699]) Replace platform.uname by sys.getwindowsversion

Refs #2881

comment:11 Changed 10 years ago by therve

Keywords: review added
Owner: therve deleted
Status: reopenednew

That looks better.

comment:12 Changed 10 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to therve

I guess we can probably just use sys.getwindowsversion instead of that and win32api.GetVersionEx.

comment:13 Changed 10 years ago by therve

Keywords: review added
Owner: therve deleted

That's a good guess.

comment:14 Changed 10 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to therve

Looks good... again. ;) Please merge.

comment:15 Changed 10 years ago by therve

Resolution: fixed
Status: newclosed

(In [23715]) Merge vista-2881

Author: therve Reviewer: exarkun Fixes #2881

Add twisted.python.runtime.Platform.isVista: this method is used to differentiate Vista/Server 2008 from previous Windows versions. This is first used to change a Multicast test from todo to pass.

(Remerge using sys.getwindowsversion instead of platform.uname)

comment:16 Changed 7 years ago by <automation>

Owner: therve deleted
Note: See TracTickets for help on using tickets.