From 4a11ffedd943de71a6dce8976c243806a1cafbd1 Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Mon, 15 Dec 2014 14:00:01 -0800 Subject: [PATCH 1/4] Include buildutils/* in package --- MANIFEST.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 3d387c3..fc2d9af 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include README.md -include requirements.txt \ No newline at end of file +include requirements.txt +include buildutils/* From 544efbddac730e6dc33474915da1bb666a49c4e2 Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Sun, 28 Dec 2014 00:02:57 -0800 Subject: [PATCH 2/4] Change setup.py to only use cython if it's available --- setup.py | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 379a84a..b0c88c6 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,21 @@ #!/usr/bin/env python from __future__ import print_function +use_cython = True try: from Cython.Build import cythonize import Cython except ImportError: - raise RuntimeError('No cython installed. Please run `pip install cython`') + use_cython = False -if Cython.__version__ < '0.19.1': - raise RuntimeError('Old cython installed (%s). Please run `pip install -U cython`' % Cython.__version__) +if use_cython and Cython.__version__ < '0.19.1': + use_cython = False import pkg_resources setuptools_version = pkg_resources.get_distribution("setuptools").version if setuptools_version < '0.8': - raise RuntimeError('Old setuptools installed (%s). Please run `pip install -U setuptools`. Running `pip install pycapnp` will not work alone, since setuptools needs to be upgraded before installing anything else.' % setuptools_version) + # older versions of setuptools don't work with cython + use_cython = False from distutils.core import setup import os @@ -21,7 +23,11 @@ import sys from buildutils import test_build, fetch_libcapnp, build_libcapnp, info from distutils.errors import CompileError from distutils.extension import Extension -from Cython.Distutils import build_ext as build_ext_c +if use_cython: + from Cython.Distutils import build_ext as build_ext_c +else: + from distutils.command.build_ext import build_ext as build_ext_c + _this_dir = os.path.dirname(__file__) MAJOR = 0 @@ -29,6 +35,7 @@ MINOR = 5 MICRO = 0 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) + # Write version info def write_version_py(filename=None): cnt = """\ @@ -79,8 +86,8 @@ force_system_libcapnp = "--force-system-libcapnp" in sys.argv if force_system_libcapnp: sys.argv.remove("--force-system-libcapnp") -class build_libcapnp_ext(build_ext_c): +class build_libcapnp_ext(build_ext_c): def build_extension(self, ext): build_ext_c.build_extension(self, ext) @@ -110,19 +117,27 @@ class build_libcapnp_ext(build_ext_c): self.library_dirs += [os.path.join(build_dir, 'lib')] return build_ext_c.run(self) + +if use_cython: + extensions = cythonize('capnp/lib/*.pyx') +else: + extensions = [Extension("capnp.lib.capnp", ["capnp/lib/capnp.cpp"], + include_dirs=["."], + language='c++', + extra_compile_args=['--std=c++11'], + libraries=['capnpc', 'capnp-rpc', 'capnp', 'kj-async', 'kj'])] + setup( name="pycapnp", packages=["capnp"], version=VERSION, package_data={'capnp': ['*.pxd', '*.h', '*.capnp', 'helpers/*.pxd', 'helpers/*.h', 'includes/*.pxd', 'lib/*.pxd', 'lib/*.py', 'lib/*.pyx', 'templates/*']}, - ext_modules=cythonize('capnp/lib/*.pyx'), + ext_modules=extensions, cmdclass = { 'clean': clean, 'build_ext': build_libcapnp_ext }, - install_requires=[ - 'cython >= 0.21', - 'setuptools >= 0.8'], + install_requires=[], entry_points={ 'console_scripts' : ['capnpc-cython = capnp._gen:main'] }, From 826728ba7f5272888f31ab51518794b1c30fbd9f Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Sun, 28 Dec 2014 00:03:55 -0800 Subject: [PATCH 3/4] Bump version for v0.5.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b0c88c6..ac46c13 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ _this_dir = os.path.dirname(__file__) MAJOR = 0 MINOR = 5 -MICRO = 0 +MICRO = 1 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) From 8e0a77b7a4c7936007aa804e34636fc2cb2b406c Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Sun, 28 Dec 2014 00:04:08 -0800 Subject: [PATCH 4/4] Update changelog for v0.5.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5bdcc0..ee45ec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.5.1 (2014-12-27) +- Remove installation dependency on cython. We now have no dependencies since libcapnp will automatically build as well. + + ## v0.5.0 (2014-12-15) - Timer class `capnp.getTimer()` - pycapnp is now thread-safe and allows an event loop to be run in each thread