[Checkins] SVN: persistent/trunk/ Add explicity support for PyPy.
Tres Seaver
cvs-admin at zope.org
Mon May 14 23:22:25 UTC 2012
Log message for revision 125876:
Add explicity support for PyPy.
Drop support for Python < 2.6.
Changed:
U persistent/trunk/CHANGES.txt
U persistent/trunk/persistent/tests/test_timestamp.py
U persistent/trunk/persistent/timestamp.py
U persistent/trunk/setup.py
U persistent/trunk/tox.ini
-=-
Modified: persistent/trunk/CHANGES.txt
===================================================================
--- persistent/trunk/CHANGES.txt 2012-05-14 23:22:18 UTC (rev 125875)
+++ persistent/trunk/CHANGES.txt 2012-05-14 23:22:22 UTC (rev 125876)
@@ -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
Modified: persistent/trunk/persistent/tests/test_timestamp.py
===================================================================
--- persistent/trunk/persistent/tests/test_timestamp.py 2012-05-14 23:22:18 UTC (rev 125875)
+++ persistent/trunk/persistent/tests/test_timestamp.py 2012-05-14 23:22:22 UTC (rev 125876)
@@ -53,6 +53,11 @@
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
Modified: persistent/trunk/persistent/timestamp.py
===================================================================
--- persistent/trunk/persistent/timestamp.py 2012-05-14 23:22:18 UTC (rev 125875)
+++ persistent/trunk/persistent/timestamp.py 2012-05-14 23:22:22 UTC (rev 125876)
@@ -57,7 +57,7 @@
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 @@
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)
Modified: persistent/trunk/setup.py
===================================================================
--- persistent/trunk/setup.py 2012-05-14 23:22:18 UTC (rev 125875)
+++ persistent/trunk/setup.py 2012-05-14 23:22:22 UTC (rev 125876)
@@ -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 @@
+ '\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 @@
"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 @@
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,
Modified: persistent/trunk/tox.ini
===================================================================
--- persistent/trunk/tox.ini 2012-05-14 23:22:18 UTC (rev 125875)
+++ persistent/trunk/tox.ini 2012-05-14 23:22:22 UTC (rev 125876)
@@ -3,7 +3,7 @@
# 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 =
More information about the checkins
mailing list