Hello community, here is the log from the commit of package python-monotonic for openSUSE:Factory checked in at 2016-03-02 14:21:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-monotonic (Old) and /work/SRC/openSUSE:Factory/.python-monotonic.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-monotonic" Changes: -------- --- /work/SRC/openSUSE:Factory/python-monotonic/python-monotonic.changes 2015-09-02 00:35:34.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-monotonic.new/python-monotonic.changes 2016-03-02 14:21:32.000000000 +0100 @@ -1,0 +2,7 @@ +Mon Feb 15 14:09:38 UTC 2016 - [email protected] + +- update to 0.6: + * Changed AttributeError flow control to getattr-with-default-argument + * Added support for pre-Vista Windows versions using GetTickCount + +------------------------------------------------------------------- Old: ---- monotonic-0.3.tar.gz New: ---- monotonic-0.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-monotonic.spec ++++++ --- /var/tmp/diff_new_pack.6j1PbR/_old 2016-03-02 14:21:33.000000000 +0100 +++ /var/tmp/diff_new_pack.6j1PbR/_new 2016-03-02 14:21:33.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-monotonic # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: python-monotonic -Version: 0.3 +Version: 0.6 Release: 0 Summary: An implementation of time.monotonic() for Python 2 & < 33 License: Apache-2.0 ++++++ monotonic-0.3.tar.gz -> monotonic-0.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monotonic-0.3/PKG-INFO new/monotonic-0.6/PKG-INFO --- old/monotonic-0.3/PKG-INFO 2015-07-29 19:01:32.000000000 +0200 +++ new/monotonic-0.6/PKG-INFO 2016-01-24 12:50:03.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: monotonic -Version: 0.3 +Version: 0.6 Summary: An implementation of time.monotonic() for Python 2 & < 3.3 Home-page: https://github.com/atdt/monotonic Author: Ori Livneh @@ -20,7 +20,7 @@ +-------------+--------------------+ | Linux, BSD | clock_gettime(3) | +-------------+--------------------+ - | Windows | GetTickCount64 | + | Windows | GetTickCount[64] | +-------------+--------------------+ | OS X | mach_absolute_time | +-------------+--------------------+ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monotonic-0.3/monotonic.egg-info/PKG-INFO new/monotonic-0.6/monotonic.egg-info/PKG-INFO --- old/monotonic-0.3/monotonic.egg-info/PKG-INFO 2015-07-29 19:01:32.000000000 +0200 +++ new/monotonic-0.6/monotonic.egg-info/PKG-INFO 2016-01-24 12:50:03.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: monotonic -Version: 0.3 +Version: 0.6 Summary: An implementation of time.monotonic() for Python 2 & < 3.3 Home-page: https://github.com/atdt/monotonic Author: Ori Livneh @@ -20,7 +20,7 @@ +-------------+--------------------+ | Linux, BSD | clock_gettime(3) | +-------------+--------------------+ - | Windows | GetTickCount64 | + | Windows | GetTickCount[64] | +-------------+--------------------+ | OS X | mach_absolute_time | +-------------+--------------------+ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monotonic-0.3/monotonic.egg-info/pbr.json new/monotonic-0.6/monotonic.egg-info/pbr.json --- old/monotonic-0.3/monotonic.egg-info/pbr.json 2015-07-29 19:01:32.000000000 +0200 +++ new/monotonic-0.6/monotonic.egg-info/pbr.json 2016-01-24 12:50:03.000000000 +0100 @@ -1 +1 @@ -{"is_release": false, "git_version": "cb3c90150f"} \ No newline at end of file +{"is_release": true, "git_version": "945f255545"} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monotonic-0.3/monotonic.py new/monotonic-0.6/monotonic.py --- old/monotonic-0.3/monotonic.py 2015-07-29 18:58:47.000000000 +0200 +++ new/monotonic-0.6/monotonic.py 2016-01-24 12:47:27.000000000 +0100 @@ -13,7 +13,7 @@ +-------------+--------------------+ | Linux, BSD | clock_gettime(3) | +-------------+--------------------+ - | Windows | GetTickCount64 | + | Windows | GetTickCount[64] | +-------------+--------------------+ | OS X | mach_absolute_time | +-------------+--------------------+ @@ -41,27 +41,14 @@ import ctypes import ctypes.util import os -import platform -import re import sys import time +import threading __all__ = ('monotonic',) -def get_os_release(): - """Get the leading numeric component of the OS release.""" - return re.match('[\d.]+', platform.release()).group(0) - - -def compare_versions(v1, v2): - """Compare two version strings.""" - def normalize(v): - return map(int, re.sub(r'(\.0+)*$', '', v).split('.')) - return cmp(normalize(v1), normalize(v2)) - - try: monotonic = time.monotonic except AttributeError: @@ -69,7 +56,7 @@ if sys.platform == 'darwin': # OS X, iOS # See Technical Q&A QA1398 of the Mac Developer Library: # <https://developer.apple.com/library/mac/qa/qa1398/> - libc = ctypes.CDLL('libc.dylib', use_errno=True) + libc = ctypes.CDLL('/usr/lib/libc.dylib', use_errno=True) class mach_timebase_info_data_t(ctypes.Structure): """System timebase info. Defined in <mach/mach_time.h>.""" @@ -87,24 +74,57 @@ """Monotonic clock, cannot go backward.""" return mach_absolute_time() / ticks_per_second - elif sys.platform.startswith('win32'): - # Windows Vista / Windows Server 2008 or newer. - GetTickCount64 = ctypes.windll.kernel32.GetTickCount64 - GetTickCount64.restype = ctypes.c_ulonglong - - def monotonic(): - """Monotonic clock, cannot go backward.""" - return GetTickCount64() / 1000.0 - - elif sys.platform.startswith('cygwin'): - # Cygwin - kernel32 = ctypes.cdll.LoadLibrary('kernel32.dll') - GetTickCount64 = kernel32.GetTickCount64 - GetTickCount64.restype = ctypes.c_ulonglong - - def monotonic(): - """Monotonic clock, cannot go backward.""" - return GetTickCount64() / 1000.0 + elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + if sys.platform.startswith('cygwin'): + # Note: cygwin implements clock_gettime (CLOCK_MONOTONIC = 4) since + # version 1.7.6. Using raw WinAPI for maximum version compatibility. + + # Ugly hack using the wrong calling convention (in 32-bit mode) + # because ctypes has no windll under cygwin (and it also seems that + # the code letting you select stdcall in _ctypes doesn't exist under + # the preprocessor definitions relevant to cygwin). + # This is 'safe' because: + # 1. The ABI of GetTickCount and GetTickCount64 is identical for + # both calling conventions because they both have no parameters. + # 2. libffi masks the problem because after making the call it doesn't + # touch anything through esp and epilogue code restores a correct + # esp from ebp afterwards. + kernel32 = ctypes.cdll.kernel32 + else: + kernel32 = ctypes.windll.kernel32 + + GetTickCount64 = getattr(kernel32, 'GetTickCount64', None) + if GetTickCount64: + # Windows Vista / Windows Server 2008 or newer. + GetTickCount64.restype = ctypes.c_ulonglong + + def monotonic(): + """Monotonic clock, cannot go backward.""" + return GetTickCount64() / 1000.0 + + else: + # Before Windows Vista. + GetTickCount = kernel32.GetTickCount + GetTickCount.restype = ctypes.c_uint32 + + get_tick_count_lock = threading.Lock() + get_tick_count_last_sample = 0 + get_tick_count_wraparounds = 0 + + def monotonic(): + """Monotonic clock, cannot go backward.""" + global get_tick_count_last_sample + global get_tick_count_wraparounds + + with get_tick_count_lock: + current_sample = GetTickCount() + if current_sample < get_tick_count_last_sample: + get_tick_count_wraparounds += 1 + get_tick_count_last_sample = current_sample + + final_milliseconds = get_tick_count_wraparounds << 32 + final_milliseconds += get_tick_count_last_sample + return final_milliseconds / 1000.0 else: try: @@ -119,13 +139,8 @@ _fields_ = (('tv_sec', ctypes.c_long), ('tv_nsec', ctypes.c_long)) - ts = timespec() - if sys.platform.startswith('linux'): - if compare_versions(get_os_release(), '2.6.28') > 0: - CLOCK_MONOTONIC = 4 # CLOCK_MONOTONIC_RAW - else: - CLOCK_MONOTONIC = 1 + CLOCK_MONOTONIC = 1 elif sys.platform.startswith('freebsd'): CLOCK_MONOTONIC = 4 elif sys.platform.startswith('sunos5'): @@ -135,6 +150,7 @@ def monotonic(): """Monotonic clock, cannot go backward.""" + ts = timespec() if clock_gettime(CLOCK_MONOTONIC, ctypes.pointer(ts)): errno = ctypes.get_errno() raise OSError(errno, os.strerror(errno)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/monotonic-0.3/setup.py new/monotonic-0.6/setup.py --- old/monotonic-0.3/setup.py 2015-07-29 18:59:17.000000000 +0200 +++ new/monotonic-0.6/setup.py 2016-01-24 12:48:11.000000000 +0100 @@ -13,7 +13,7 @@ +-------------+--------------------+ | Linux, BSD | clock_gettime(3) | +-------------+--------------------+ -| Windows | GetTickCount64 | +| Windows | GetTickCount[64] | +-------------+--------------------+ | OS X | mach_absolute_time | +-------------+--------------------+ @@ -31,7 +31,7 @@ setup( name='monotonic', - version='0.3', + version='0.6', license='Apache', author='Ori Livneh', author_email='[email protected]',
