Add Debian packaging

This commit is contained in:
Ori Livneh 2014-11-29 21:34:54 +00:00
parent 1ff1ba9f75
commit 44fa80156b
17 changed files with 582 additions and 0 deletions

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
python-monotonic (0.1-1) unstable; urgency=low
* Initial package.
-- Ori Livneh <ori@wikimedia.org> Sat, 29 Nov 2014 19:42:14 +0000

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

36
debian/control vendored Normal file
View File

@ -0,0 +1,36 @@
Source: python-monotonic
Section: python
Priority: optional
Maintainer: Ori Livneh <ori@wikimedia.org>
Build-Depends: autopkgtest,
debhelper (>= 9),
python-all (>= 2.6.6-3~),
python-setuptools (>= 0.6b3),
python3-all,
python3-setuptools
Standards-Version: 3.9.4
Vcs-Browser: http://github.com/atdt/monotonic.git
Vcs-Git: git://github.com/atdt/monotonic.git
Homepage: https://pypi.python.org/pypi/monotonic
Package: python-monotonic
Architecture: all
Pre-Depends: dpkg (>= 1.15.6~)
Depends: ${misc:Depends}, ${python:Depends}
Description: A monotonic clock implementation for Python
This module provides a monotonic() function which returns the
value (in fractional seconds) of a monotonic clock, i.e. a clock
which never goes backwards.
.
This package contains the Python 2.x module.
Package: python3-monotonic
Architecture: all
Pre-Depends: dpkg (>= 1.15.6~)
Depends: python3 (>= 3.2.3), ${misc:Depends}
Description: A monotonic clock implementation for Python
This module provides a monotonic() function which returns the
value (in fractional seconds) of a monotonic clock, i.e. a clock
which never goes backwards.
.
This package contains the Python 3.x module.

7
debian/copyright vendored Normal file
View File

@ -0,0 +1,7 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: monotonic
Source: https://github.com/atdt/monotonic
Files: *
Copyright: (c) 2014 Ori Livneh <ori@wikimedia.org>
License: Apache

1
debian/docs vendored Normal file
View File

@ -0,0 +1 @@
README.md

8
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,8 @@
[DEFAULT]
upstream-branch = master
debian-branch = debian/unstable
upstream-tag = v%(version)s
compression = xz
[git-buildpackage]
export-dir = ../build-area/

8
debian/python-monotonic.debhelper.log vendored Normal file
View File

@ -0,0 +1,8 @@
dh_auto_configure
override_dh_auto_build dh_auto_build
dh_auto_build
dh_auto_test
dh_prep
override_dh_auto_install dh_auto_install
dh_auto_install
dh_install

2
debian/python-monotonic.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/lib/python2*/

View File

@ -0,0 +1,120 @@
# -*- coding: utf-8 -*-
"""
monotonic
~~~~~~~~~
This module provides a ``monotonic()`` function which returns the
value (in fractional seconds) of a clock which never goes backwards.
On Python 3.3 or newer, ``monotonic`` will be an alias of
``time.monotonic`` from the standard library. On older versions,
it will fall back to an equivalent implementation:
+-------------+--------------------+
| Linux, BSD | clock_gettime(3) |
+-------------+--------------------+
| Windows | GetTickCount64 |
+-------------+--------------------+
| OS X | mach_absolute_time |
+-------------+--------------------+
If no suitable implementation exists for the current platform,
attempting to import this module (or to import from it) will
cause a RuntimeError exception to be raised.
Copyright 2014 Ori Livneh <ori@wikimedia.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import, division
import ctypes
import ctypes.util
import os
import sys
import time
__all__ = ('monotonic',)
try:
monotonic = time.monotonic
except AttributeError:
try:
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)
class mach_timebase_info_data_t(ctypes.Structure):
"""System timebase info. Defined in <mach/mach_time.h>."""
_fields_ = (('numer', ctypes.c_uint32),
('denom', ctypes.c_uint32))
mach_absolute_time = libc.mach_absolute_time
mach_absolute_time.restype = ctypes.c_uint64
timebase = mach_timebase_info_data_t()
libc.mach_timebase_info(ctypes.byref(timebase))
ticks_per_second = timebase.numer / timebase.denom * 1.0e9
def monotonic():
"""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
else:
try:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('c'),
use_errno=True).clock_gettime
except AttributeError:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('rt'),
use_errno=True).clock_gettime
class timespec(ctypes.Structure):
"""Time specification, as described in clock_gettime(3)."""
_fields_ = (('tv_sec', ctypes.c_long),
('tv_nsec', ctypes.c_long))
ts = timespec()
if sys.platform.startswith('linux'):
CLOCK_MONOTONIC = 1
elif sys.platform.startswith('freebsd'):
CLOCK_MONOTONIC = 4
elif 'bsd' in sys.platform:
CLOCK_MONOTONIC = 3
def monotonic():
"""Monotonic clock, cannot go backward."""
if clock_gettime(CLOCK_MONOTONIC, ctypes.pointer(ts)):
errno = ctypes.get_errno()
raise OSError(errno, os.strerror(errno))
return ts.tv_sec + ts.tv_nsec / 1.0e9
# Perform a sanity-check.
if monotonic() - monotonic() >= 0:
raise ValueError('monotonic() is not monotonic!')
except Exception:
raise RuntimeError('no suitable implementation for this system')

View File

@ -0,0 +1,8 @@
dh_auto_configure
override_dh_auto_build dh_auto_build
dh_auto_build
dh_auto_test
dh_prep
override_dh_auto_install dh_auto_install
dh_auto_install
dh_install

1
debian/python3-monotonic.install vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/python3/

View File

@ -0,0 +1,120 @@
# -*- coding: utf-8 -*-
"""
monotonic
~~~~~~~~~
This module provides a ``monotonic()`` function which returns the
value (in fractional seconds) of a clock which never goes backwards.
On Python 3.3 or newer, ``monotonic`` will be an alias of
``time.monotonic`` from the standard library. On older versions,
it will fall back to an equivalent implementation:
+-------------+--------------------+
| Linux, BSD | clock_gettime(3) |
+-------------+--------------------+
| Windows | GetTickCount64 |
+-------------+--------------------+
| OS X | mach_absolute_time |
+-------------+--------------------+
If no suitable implementation exists for the current platform,
attempting to import this module (or to import from it) will
cause a RuntimeError exception to be raised.
Copyright 2014 Ori Livneh <ori@wikimedia.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import, division
import ctypes
import ctypes.util
import os
import sys
import time
__all__ = ('monotonic',)
try:
monotonic = time.monotonic
except AttributeError:
try:
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)
class mach_timebase_info_data_t(ctypes.Structure):
"""System timebase info. Defined in <mach/mach_time.h>."""
_fields_ = (('numer', ctypes.c_uint32),
('denom', ctypes.c_uint32))
mach_absolute_time = libc.mach_absolute_time
mach_absolute_time.restype = ctypes.c_uint64
timebase = mach_timebase_info_data_t()
libc.mach_timebase_info(ctypes.byref(timebase))
ticks_per_second = timebase.numer / timebase.denom * 1.0e9
def monotonic():
"""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
else:
try:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('c'),
use_errno=True).clock_gettime
except AttributeError:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('rt'),
use_errno=True).clock_gettime
class timespec(ctypes.Structure):
"""Time specification, as described in clock_gettime(3)."""
_fields_ = (('tv_sec', ctypes.c_long),
('tv_nsec', ctypes.c_long))
ts = timespec()
if sys.platform.startswith('linux'):
CLOCK_MONOTONIC = 1
elif sys.platform.startswith('freebsd'):
CLOCK_MONOTONIC = 4
elif 'bsd' in sys.platform:
CLOCK_MONOTONIC = 3
def monotonic():
"""Monotonic clock, cannot go backward."""
if clock_gettime(CLOCK_MONOTONIC, ctypes.pointer(ts)):
errno = ctypes.get_errno()
raise OSError(errno, os.strerror(errno))
return ts.tv_sec + ts.tv_nsec / 1.0e9
# Perform a sanity-check.
if monotonic() - monotonic() >= 0:
raise ValueError('monotonic() is not monotonic!')
except Exception:
raise RuntimeError('no suitable implementation for this system')

22
debian/rules vendored Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/make -f
PYTHON3:=$(shell py3versions -r)
py3sdo=set -ex; $(foreach py, $(PYTHON3), $(py) $(1);)
UPSTREAM_GIT = git://github.com/atdt/jsonschema.git
%:
dh $@ --with python2,python3
override_dh_auto_build:
dh_auto_build
$(call py3sdo, setup.py build)
override_dh_auto_install:
dh_auto_install
$(call py3sdo, setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb)
override_dh_auto_clean:
dh_auto_clean
rm -rf build
rm -rf *.egg-info __pycache__

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -0,0 +1,120 @@
# -*- coding: utf-8 -*-
"""
monotonic
~~~~~~~~~
This module provides a ``monotonic()`` function which returns the
value (in fractional seconds) of a clock which never goes backwards.
On Python 3.3 or newer, ``monotonic`` will be an alias of
``time.monotonic`` from the standard library. On older versions,
it will fall back to an equivalent implementation:
+-------------+--------------------+
| Linux, BSD | clock_gettime(3) |
+-------------+--------------------+
| Windows | GetTickCount64 |
+-------------+--------------------+
| OS X | mach_absolute_time |
+-------------+--------------------+
If no suitable implementation exists for the current platform,
attempting to import this module (or to import from it) will
cause a RuntimeError exception to be raised.
Copyright 2014 Ori Livneh <ori@wikimedia.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import, division
import ctypes
import ctypes.util
import os
import sys
import time
__all__ = ('monotonic',)
try:
monotonic = time.monotonic
except AttributeError:
try:
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)
class mach_timebase_info_data_t(ctypes.Structure):
"""System timebase info. Defined in <mach/mach_time.h>."""
_fields_ = (('numer', ctypes.c_uint32),
('denom', ctypes.c_uint32))
mach_absolute_time = libc.mach_absolute_time
mach_absolute_time.restype = ctypes.c_uint64
timebase = mach_timebase_info_data_t()
libc.mach_timebase_info(ctypes.byref(timebase))
ticks_per_second = timebase.numer / timebase.denom * 1.0e9
def monotonic():
"""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
else:
try:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('c'),
use_errno=True).clock_gettime
except AttributeError:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('rt'),
use_errno=True).clock_gettime
class timespec(ctypes.Structure):
"""Time specification, as described in clock_gettime(3)."""
_fields_ = (('tv_sec', ctypes.c_long),
('tv_nsec', ctypes.c_long))
ts = timespec()
if sys.platform.startswith('linux'):
CLOCK_MONOTONIC = 1
elif sys.platform.startswith('freebsd'):
CLOCK_MONOTONIC = 4
elif 'bsd' in sys.platform:
CLOCK_MONOTONIC = 3
def monotonic():
"""Monotonic clock, cannot go backward."""
if clock_gettime(CLOCK_MONOTONIC, ctypes.pointer(ts)):
errno = ctypes.get_errno()
raise OSError(errno, os.strerror(errno))
return ts.tv_sec + ts.tv_nsec / 1.0e9
# Perform a sanity-check.
if monotonic() - monotonic() >= 0:
raise ValueError('monotonic() is not monotonic!')
except Exception:
raise RuntimeError('no suitable implementation for this system')

View File

@ -0,0 +1,120 @@
# -*- coding: utf-8 -*-
"""
monotonic
~~~~~~~~~
This module provides a ``monotonic()`` function which returns the
value (in fractional seconds) of a clock which never goes backwards.
On Python 3.3 or newer, ``monotonic`` will be an alias of
``time.monotonic`` from the standard library. On older versions,
it will fall back to an equivalent implementation:
+-------------+--------------------+
| Linux, BSD | clock_gettime(3) |
+-------------+--------------------+
| Windows | GetTickCount64 |
+-------------+--------------------+
| OS X | mach_absolute_time |
+-------------+--------------------+
If no suitable implementation exists for the current platform,
attempting to import this module (or to import from it) will
cause a RuntimeError exception to be raised.
Copyright 2014 Ori Livneh <ori@wikimedia.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import, division
import ctypes
import ctypes.util
import os
import sys
import time
__all__ = ('monotonic',)
try:
monotonic = time.monotonic
except AttributeError:
try:
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)
class mach_timebase_info_data_t(ctypes.Structure):
"""System timebase info. Defined in <mach/mach_time.h>."""
_fields_ = (('numer', ctypes.c_uint32),
('denom', ctypes.c_uint32))
mach_absolute_time = libc.mach_absolute_time
mach_absolute_time.restype = ctypes.c_uint64
timebase = mach_timebase_info_data_t()
libc.mach_timebase_info(ctypes.byref(timebase))
ticks_per_second = timebase.numer / timebase.denom * 1.0e9
def monotonic():
"""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
else:
try:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('c'),
use_errno=True).clock_gettime
except AttributeError:
clock_gettime = ctypes.CDLL(ctypes.util.find_library('rt'),
use_errno=True).clock_gettime
class timespec(ctypes.Structure):
"""Time specification, as described in clock_gettime(3)."""
_fields_ = (('tv_sec', ctypes.c_long),
('tv_nsec', ctypes.c_long))
ts = timespec()
if sys.platform.startswith('linux'):
CLOCK_MONOTONIC = 1
elif sys.platform.startswith('freebsd'):
CLOCK_MONOTONIC = 4
elif 'bsd' in sys.platform:
CLOCK_MONOTONIC = 3
def monotonic():
"""Monotonic clock, cannot go backward."""
if clock_gettime(CLOCK_MONOTONIC, ctypes.pointer(ts)):
errno = ctypes.get_errno()
raise OSError(errno, os.strerror(errno))
return ts.tv_sec + ts.tv_nsec / 1.0e9
# Perform a sanity-check.
if monotonic() - monotonic() >= 0:
raise ValueError('monotonic() is not monotonic!')
except Exception:
raise RuntimeError('no suitable implementation for this system')

2
debian/watch vendored Normal file
View File

@ -0,0 +1,2 @@
version=3
https://github.com/atdt/monotonic/tags .*v(\d[\d\.]+)\.tar\.gz