Skip to content

Commit

Permalink
Proper dist generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaag committed Dec 7, 2010
1 parent 3f87061 commit 75150bb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
*.pyc
_build/
build/
dist/
MANIFEST
2 changes: 2 additions & 0 deletions MANIFEST.in
@@ -0,0 +1,2 @@
include http-parser/http_parser.[ch]
include bjoern/*
8 changes: 5 additions & 3 deletions Makefile
@@ -1,5 +1,5 @@
SOURCE_DIR = bjoern
BUILD_DIR = _build
BUILD_DIR = build
objects = $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.o, \
$(wildcard $(SOURCE_DIR)/*.c))

Expand Down Expand Up @@ -78,5 +78,7 @@ memwatch:
tail -n +25 /proc/$$(pidof -s python)/smaps'

release:
@mkdir -p _release
cp http-parser/http_parser.{c,h} bjoern/* setup.py LICENSE _release
python setup.py sdist

upload:
python setup.py sdist upload
2 changes: 1 addition & 1 deletion http-parser
Submodule http-parser updated from 047ced to 03970a
27 changes: 14 additions & 13 deletions setup.py
@@ -1,18 +1,10 @@
import os
from distutils.core import setup, Extension

# make print-env
stdout = '''
CFLAGS=-D WANT_SENDFILE -D WANT_SIGINT_HANDLING -std=c99 -fno-strict-aliasing -Wall -Wextra -Wno-unused -g -O3 -fPIC
CPPFLAGS=-I /usr/include/python2.7/ -I . -I bjoern -I http-parser
LDFLAGS=-l python2.7 -l ev -shared --as-needed
args=http_parser.c request.c bjoernmodule.c server.c wsgi.c'''

env = dict(line.split('=', 1) for line in stdout.split('\n') if '=' in line)

source_files = env.pop('args').split()

os.environ.update(env)
SOURCE_FILES = [
'http-parser/http_parser.c', 'bjoern/request.c', 'bjoern/bjoernmodule.c',
'bjoern/server.c', 'bjoern/wsgi.c'
]

setup(
name = 'bjoern',
Expand All @@ -26,5 +18,14 @@
'License :: OSI Approved :: BSD License',
'Programming Language :: C',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Server'],
ext_modules = [Extension('bjoern', sources=source_files, libraries=['ev'])]
ext_modules = [
Extension(
'bjoern',
sources=SOURCE_FILES,
libraries=['ev'],
include_dirs=['http-parser'],
define_macros=[('WANT_SENDFILE', '1'), ('WANT_SIGINT_HANDLING', '1')],
extra_compile_args='-std=c99 -fno-strict-aliasing -Wall -Wextra -Wno-unused -g -fPIC'.split()
)
]
)

0 comments on commit 75150bb

Please sign in to comment.