Commit db764f69 authored by Tres Seaver's avatar Tres Seaver

Add explicity support for PyPy.

Drop support for Python < 2.6.
parent e372b094
......@@ -4,6 +4,10 @@
4.0 (unreleased)
-----------------
- Added explicity support for PyPy.
- Dropped explicit support for Python < 2.6.
- Added support for continuous integration using ``tox`` and ``jenkins``.
- Added ``setup.py docs`` alias (installs ``Sphinx`` and
......
......@@ -53,6 +53,11 @@ class TimeStampTests(unittest.TestCase):
self.assertEqual(ts.second(), 0.0)
self.assertEqual(ts.timeTime(), DELTA_SECS)
def test_ctor_from_string_non_zero(self):
before = self._makeOne(2011, 2, 16, 14, 37, 22.0)
after = self._makeOne(before.raw())
self.assertEqual(before._elements, after._elements)
def test_ctor_from_elements(self):
from persistent.timestamp import _makeOctets
from persistent.timestamp import _makeUTC
......
......@@ -57,7 +57,7 @@ _SCONV = 60.0 / (1<<16) / (1<<16)
def _makeRaw(year, month, day, hour, minute, second):
a = (((year - 1900) * 12 + month - 1) * 31 + day - 1)
a = (a * 24 + hour) * 60 + minute
b = int(second / _SCONV)
b = round(second / _SCONV)
return struct.pack('>II', a, b)
def _parseRaw(octets):
......@@ -67,7 +67,7 @@ def _parseRaw(octets):
day = a // (60 * 24) % 31 + 1
month = a // (60 * 24 * 31) % 12 + 1
year = a // (60 * 24 * 31 * 12) + 1900
second = b * _SCONV
second = round(b * _SCONV, 6) #microsecond precision
return (year, month, day, hour, minute, second)
......
......@@ -15,6 +15,8 @@
__version__ = '4.0dev'
import os
import platform
import sys
from ez_setup import use_setuptools
use_setuptools()
......@@ -31,6 +33,42 @@ README = (open(os.path.join(here, 'README.txt')).read()
+ '\n\n' +
open(os.path.join(here, 'CHANGES.txt')).read())
py_impl = getattr(platform, 'python_implementation', lambda: None)
is_pypy = py_impl() == 'PyPy'
is_jython = 'java' in sys.platform
# Jython cannot build the C optimizations, while on PyPy they are
# anti-optimizations (the C extension compatibility layer is known-slow,
# and defeats JIT opportunities).
if is_pypy or is_jython:
ext_modules = headers = []
else:
ext_modules = [Extension(name = 'persistent.cPersistence',
sources= ['persistent/cPersistence.c',
'persistent/ring.c',
],
depends = ['persistent/cPersistence.h',
'persistent/ring.h',
'persistent/ring.c',
]
),
Extension(name = 'persistent.cPickleCache',
sources= ['persistent/cPickleCache.c',
'persistent/ring.c'
],
depends = ['persistent/cPersistence.h',
'persistent/ring.h',
'persistent/ring.c',
]
),
Extension(name = 'persistent.TimeStamp',
sources= ['persistent/TimeStamp.c',
],
),
]
headers = ['persistent/cPersistence.h',
'persistent/ring.h']
setup(name='persistent',
version=__version__,
description='Translucent persistent objects',
......@@ -39,6 +77,10 @@ setup(name='persistent',
"Development Status :: 6 - Mature",
"License :: OSI Approved :: Zope Public License",
"Programming Language :: Python",
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Database",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: Microsoft :: Windows",
......@@ -52,31 +94,8 @@ setup(name='persistent',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
ext_modules = [Extension(name = 'persistent.cPersistence',
sources= ['persistent/cPersistence.c',
'persistent/ring.c',
],
depends = ['persistent/cPersistence.h',
'persistent/ring.h',
'persistent/ring.c',
]
),
Extension(name = 'persistent.cPickleCache',
sources= ['persistent/cPickleCache.c',
'persistent/ring.c'
],
depends = ['persistent/cPersistence.h',
'persistent/ring.h',
'persistent/ring.c',
]
),
Extension(name = 'persistent.TimeStamp',
sources= ['persistent/TimeStamp.c',
],
),
],
headers = ['persistent/cPersistence.h',
'persistent/ring.h'],
ext_modules = ext_modules,
headers = headers,
tests_require = TESTS_REQUIRE,
extras_require = {
'test': TESTS_REQUIRE,
......
......@@ -3,7 +3,7 @@ envlist =
# Jython support pending 2.7 support, due 2012-07-15 or so. See:
# http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
# py26,py27,py32,jython,pypy,coverage,docs
py26,py27,coverage,docs
py26,py27,pypy,coverage,docs
[testenv]
deps =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment