Skip to content

Commit

Permalink
Removed docker build from python build
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Jan 6, 2019
1 parent 2cc9c76 commit d47556f
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 16 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ else()
endif()

if (PSP_CPP_BUILD_TESTS)
message(WARNING "${Cyan}Building CPP tests${ColorReset}")
message(WARNING "${Cyan}Building C++ tests${ColorReset}")
else()
message(WARNING "${Cyan}Skipping CPP tests${ColorReset}")
message(WARNING "${Cyan}Skipping C++ tests${ColorReset}")
endif()

if (NOT PSP_CPP_BUILD_STRICT)
message(WARNING "${Cyan}Building CPP without strict warnings${ColorReset}")
message(WARNING "${Cyan}Building C++ without strict warnings${ColorReset}")
endif()

#######################
Expand Down
5 changes: 1 addition & 4 deletions docker/cpp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ WORKDIR /usr/src/app
ADD . /usr/src/app

RUN apt-get update
RUN apt-get -y install apt-transport-https libtbb-dev cmake libboost-all-dev

RUN yarn
RUN yarn build_cpp
RUN apt-get -y install apt-transport-https libtbb-dev cmake libboost-all-dev
4 changes: 1 addition & 3 deletions docker/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@ RUN ln -s /usr/local/lib/libboost_python37.so /usr/local/lib/libboost_python.so
RUN ln -s /usr/local/lib/libboost_numpy37.so /usr/local/lib/libboost_numpy.so

RUN python3 -m pip install codecov nose2 mock flake8
RUN python3 -m pip install -r python/requirements.txt

RUN DOCKER=true cd python && make build && make test
RUN python3 -m pip install 'numpy>=1.13.1' 'pandas>=0.22.0'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"build,bench": "npm run --silent build && npm run --silent bench",
"build": "node scripts/build.js",
"build_cpp": "lerna run build:cpp ${PACKAGE:+--scope=@jpmorganchase/perspective} --stream",
"build_python": "cd python && python3 setup.py build",
"build_python": "node scripts/build_python.js",
"install_python": "cd python && python3 setup.py install",
"bench": "node scripts/bench.js",
"docs": "lerna run docs --silent --stream",
Expand Down
10 changes: 5 additions & 5 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function compileRuntime({inputFile, inputWasmFile, format, packageName}) {

if (inputWasmFile) {
console.log("-- Copying WASM file %s", inputWasmFile);
fs.copyFileSync(path.join(BUILD_DIRECTORY, inputWasmFile), path.join(path.join(OUTPUT_DIRECTORY, "build"), inputWasmFile));
fs.copyFileSync(path.join(BUILD_DIRECTORY, inputWasmFile), path.join(OUTPUT_DIRECTORY, "build", inputWasmFile));
}

console.debug("-- Creating wrapped js runtime");
Expand All @@ -101,23 +101,23 @@ function compileRuntime({inputFile, inputWasmFile, format, packageName}) {
});
}

fs.writeFileSync(path.join(path.join(OUTPUT_DIRECTORY, "obj"), inputFile), source);
fs.writeFileSync(path.join(OUTPUT_DIRECTORY, "obj", inputFile), source);
}

function emsdk() {
function docker(image = "emsdk") {
console.log("-- Creating emsdk docker image");
let cmd = "docker run --rm -it";
if (process.env.PSP_CPU_COUNT) {
cmd += ` --cpus="${parseInt(process.env.PSP_CPU_COUNT)}.0"`;
}
cmd += " -v $(pwd):/src -e PACKAGE=${PACKAGE} perspective/emsdk";
cmd += ` -v $(pwd):/src -e PACKAGE=${process.env.PACKAGE} perspective/${image}`;
return cmd;
}

function compileCPP() {
let cmd = `emcmake cmake ../ && emmake make -j${process.env.PSP_CPU_COUNT || os.cpus().length}`;
if (process.env.PSP_DOCKER) {
cmd = `${emsdk()} bash -c 'cd obj && ${cmd}'`;
cmd = `${docker()} bash -c 'cd obj && ${cmd}'`;
} else {
cmd = `cd ${BASE_DIRECTORY} && ${cmd}`;
}
Expand Down
33 changes: 33 additions & 0 deletions scripts/build_python.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/

const execSync = require("child_process").execSync;

const execute = cmd => execSync(cmd, {stdio: "inherit"});

function docker(image = "emsdk") {
console.log(`-- Creating ${image} docker image`);
let cmd = "docker run --rm -it";
if (process.env.PSP_CPU_COUNT) {
cmd += ` --cpus="${parseInt(process.env.PSP_CPU_COUNT)}.0"`;
}
cmd += ` -v $(pwd):/usr/src/app/python -w /usr/src/app/python perspective/${image}`;
return cmd;
}

try {
let cmd = "python3 setup.py build";
if (process.env.PSP_DOCKER) {
execute(docker("python") + " " + cmd);
} else {
execute(cmd);
}
} catch (e) {
process.exit(1);
}

0 comments on commit d47556f

Please sign in to comment.