Commit e249f9de authored by Kirill Smelkov's avatar Kirill Smelkov Committed by mdavidsaver

Fix inplace build

build_dso for inplace mode copies DSO built in build/ into worktree.
However if the destination directory does not exist yet, copy_file
fails. Fix it by making sure before copying that destination directory
exits.

Without the fix added test fails as follows:

    ...
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/dsodemo
    creating build/lib.linux-x86_64-2.7/dsodemo/lib
    x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-IbFBHb/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-IbFBHb/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/foo.o build/temp.linux-x86_64-2.7/bar.o -o build/lib.linux-x86_64-2.7/dsodemo/lib/libdemo.so.1.0 -Wl,-h,libdemo.so.1.0
    symlink libdemo.so.1.0 -> build/lib.linux-x86_64-2.7/dsodemo/lib/libdemo.so.1.0
    copying build/lib.linux-x86_64-2.7/dsodemo/lib/libdemo.so.1.0 -> dsodemo/lib
    error: [Errno 2] No such file or directory: 'dsodemo/lib/libdemo.so.1.0'
parent d9a47177
......@@ -330,6 +330,7 @@ class build_dso(dso2libmixin, Command):
#self.copy_file(outlib, outbaselib) # link="sym" seem to get the target path wrong
if self.inplace:
self.mkpath(os.path.dirname(solib))
self.copy_file(outlib, solib)
if baselib!=solib:
self.copy_file(outbaselib, baselib)
......
#!/bin/sh
set -e
die() {
echo "$@" 1>&2
exit 1
}
[ -d src/setuptools_dso ] || exit 2
PYTHON="$1"
......@@ -15,9 +20,22 @@ virtualenv env
"$PYTHON" setup.py clean -a
"$PYTHON" setup.py -v install
# inplace build
echo -e '\n* inplace build\n'
cd example
"$PYTHON" setup.py clean -a
git clean -fdx # `setup.py clean` does not clean inplace built files
"$PYTHON" -m dsodemo.cli 2>/dev/null && die "error: worktree must be clean"
"$PYTHON" setup.py -v build_dso -i
"$PYTHON" setup.py -v build_ext -i
"$PYTHON" -m dsodemo.cli
# build + install
echo -e '\n* build + install\n'
"$PYTHON" setup.py clean -a
git clean -fdx
"$PYTHON" -m dsodemo.cli 2>/dev/null && die "error: worktree must be clean"
"$PYTHON" setup.py -v install
cd ..
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment