Permalink
Browse files

Build improvements

There is a bug in CFFI that prevents us from packaging things...
  • Loading branch information...
1 parent 4612c31 commit 7a8f5f6452aed4394ad542df2b049a6d036b97ef Alvaro committed Nov 19, 2012
Showing with 53 additions and 22 deletions.
  1. +13 −1 Makefile
  2. +1 −1 README
  3. +9 −5 setup.py
  4. +30 −15 setup_libuv.py
View
@@ -48,8 +48,8 @@ clean:
rm -rf build dist
rm -rf *.egg-info __pycache__
rm -rf Library
- rm -rf doc/_build doc/__pycache__
rm -f `find . -name '*.pyc'`
+ rm -rf `find . -name '__pycache__'`
make -C libuv clean
make -C doc clean
@@ -81,3 +81,15 @@ dist:
@echo ">>> redistributable package left in dist/"
+sdist:
+ @echo ">>> Making redistributable sources package..."
+ $(PYTHON) setup.py sdist
+ @echo ">>> redistributable package left in dist/"
+
+sdist-upload: sdist
+ @echo ">>> Uploading redistributable sources package to PyPI..."
+ $(PYTHON) setup.py sdist upload
+
+sdist-register: sdist
+ @echo ">>> Registering package at PyPI..."
+ $(PYTHON) setup.py register
View
2 README
@@ -27,5 +27,5 @@ The built html files can be found in doc/_build/html afterward.
Status
======
-It doesn't work yet...
+Most of the unit tests are running now, but it doesn't work yet...
View
@@ -1,10 +1,11 @@
#!/usr/bin/env python
-import sys
+try:
+ from setuptools import setup, find_packages
+except ImportError:
+ from distutils.core import setup, find_packages
-from setuptools import find_packages
-from distutils.core import setup
from setup_libuv import libuv_build_ext, libuv_sdist, libuv_extension
@@ -23,7 +24,10 @@
url = 'http://github.com/inercia/evy',
packages = find_packages(exclude = ['tests', 'benchmarks']),
- install_requires = ['dnspython'],
+
+ install_requires = ['setuptools',
+ 'dnspython'
+ ],
zip_safe = False,
long_description = open(
@@ -36,7 +40,7 @@
cmdclass = {'build_ext': libuv_build_ext,
'sdist' : libuv_sdist},
- ext_package = 'evy.uv', # must match the package defined in the CFFI verify()
+ ext_package = 'evy', # must match the package defined in the CFFI verify()
ext_modules = [libuv_extension],
test_suite = 'nose.collector',
View
@@ -10,6 +10,7 @@
except ImportError:
from distutils.core import Extension, setup
+
from distutils.command.build_ext import build_ext
from distutils.command.sdist import sdist as _sdist
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
@@ -19,7 +20,7 @@
__here__ = os.path.dirname(__file__)
-
+#: where the libuv is found...
LIBUV_DIR = os.path.join(__here__, 'libuv')
@@ -29,7 +30,14 @@ def _system(cmd):
sys.stdout.write('Running %r in %s\n' % (cmd, os.getcwd()))
return os.system(cmd)
-def make(done=[]):
+
+def make(done = []):
+ """
+ Run the make proccess in the libuv directory
+
+ :param done:
+ :return:
+ """
print 'making libuv'
if not done:
@@ -43,13 +51,12 @@ def make(done=[]):
new_ldflags = ""
prev_ldflags = os.environ.get("LDFLAGS", "")
- if sys.platform == "darwin":
- new_cflags = new_cflags + " -U__llvm__ -arch x86_64 -arch i386"
- new_ldflags = new_cflags + " -framework CoreServices"
+ if sys.platform == 'darwin':
+ new_cflags = new_cflags + ' -O3 -U__llvm__ -arch x86_64 -arch i386'
+ new_ldflags = new_ldflags + ' -framework CoreServices'
+ elif sys.platform in ['linux', 'linux2']:
+ new_cflags = new_cflags + ' -fPIC '
- if sys.platform in ["linux", "linux2"]:
- new_cflags = new_cflags + " -fPIC"
-
os.environ["CFLAGS"] = ("%s %s" % (prev_cflags, new_cflags)).lstrip()
os.environ["LDFLAGS"] = ("%s %s" % (prev_ldflags, new_ldflags)).lstrip()
@@ -76,20 +83,28 @@ def run(self):
class libuv_build_ext(build_ext):
-
- def build_extension(self, ext):
+ """
+ Builder for the libuv 'extension'
+ """
+
+ def build_extensions(self):
+ """
+ Runs the builder
+ """
print 'building libuv extension'
make()
import evy.uv.interface
- libuv_modules = [evy.uv.interface.ffi.verifier.get_extension()]
+ libuv_extension = evy.uv.interface.ffi.verifier.get_extension()
+ self.extensions = [libuv_extension]
print 'using libuv version: %s' % evy.uv.get_version()
- return libuv_modules
+ print '(build path: %s)' % self.get_ext_fullpath(libuv_extension.name)
+
+
-libuv_extension = Extension(name='libuv', sources=[])
+libuv_extension = Extension(name = 'libuv',
+ sources = [])
-class BuildFailed(Exception):
- pass

0 comments on commit 7a8f5f6

Please sign in to comment.