Permalink
Browse files

Separate the fastlex.so build from the pylibc.so build.

fastlex is in progress, which broke the workflow of other develoopers.
  • Loading branch information...
Andy Chu
Andy Chu committed Nov 22, 2017
1 parent 107d077 commit 113311a0543afffd75b5337b57b12ffd764d84f7
Showing with 36 additions and 26 deletions.
  1. +2 −2 build/codegen.sh
  2. +20 −12 build/dev.sh
  3. +0 −12 build/setup.py
  4. +14 −0 build/setup_fastlex.py
View
@@ -67,10 +67,10 @@ all() {
osh-lex-gen-native
# Why do we need this?
rm -f _devbuild/pylibc/x86_64/fastlex.so
rm -f _devbuild/py-ext/x86_64/fastlex.so
# Note: This also does pylibc, which we don't want.
build/dev.sh all
build/dev.sh fastlex
}
# Size profiler for binaries. TODO: Fold this into benchmarks/
View
@@ -37,32 +37,40 @@ gen-help() {
# you need to run re2c again! I guess you should just provide a script to
# download it.
pylibc() {
mkdir -p _devbuild/pylibc
py-ext() {
local name=$1
local setup_script=$2
mkdir -p _devbuild/py-ext
local arch=$(uname -m)
build/setup.py build --build-lib _devbuild/pylibc/$arch
$setup_script build --build-lib _devbuild/py-ext/$arch
shopt -s failglob
local libc_so=$(echo _devbuild/pylibc/$arch/libc.so)
ln -s -f -v $libc_so libc.so
local so=$(echo _devbuild/py-ext/$arch/$name.so)
ln -s -f -v $so $name.so
file $name.so
}
local fastlex_so=$(echo _devbuild/pylibc/$arch/fastlex.so)
ln -s -f -v $fastlex_so fastlex.so
pylibc() {
py-ext libc build/setup.py
}
file libc.so fastlex.so
fastlex() {
py-ext fastlex build/setup_fastlex.py
PYTHONPATH=. native/fastlex_test.py
}
# Also done by unit.sh.
test-pylibc() {
export PYTHONPATH=.
pylibc
native/libc_test.py
native/fastlex_test.py
}
clean-pylibc() {
rm -f --verbose libc.so
rm -r -f --verbose _devbuild/pylibc
clean() {
rm -f --verbose libc.so fastlex.so
rm -r -f --verbose _devbuild/py-ext
}
all() {
View
@@ -9,15 +9,3 @@
version = '1.0',
description = 'Module for libc functions like fnmatch()',
ext_modules = [module])
# https://stackoverflow.com/questions/4541565/how-can-i-assert-from-python-c-code
module = Extension('fastlex',
sources = ['native/fastlex.c'],
undef_macros = ['NDEBUG']
)
setup(name = 'fastlex',
version = '1.0',
description = 'Module to speed up lexers',
include_dirs = ['_build/gen'],
ext_modules = [module])
View
@@ -0,0 +1,14 @@
#!/usr/bin/env python
from distutils.core import setup, Extension
# https://stackoverflow.com/questions/4541565/how-can-i-assert-from-python-c-code
module = Extension('fastlex',
sources = ['native/fastlex.c'],
undef_macros = ['NDEBUG']
)
setup(name = 'fastlex',
version = '1.0',
description = 'Module to speed up lexers',
include_dirs = ['_build/gen'],
ext_modules = [module])

0 comments on commit 113311a

Please sign in to comment.