-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #618 from HazyResearch/slimdown
Fixes to various bugs and packaging issues with the option to slim things down
- Loading branch information
Showing
18 changed files
with
177 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,6 @@ | |
# python-related | ||
*.pyc | ||
__pycache__/ | ||
|
||
# conda related | ||
/conda_build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,32 @@ | |
# Author: Jaeho Shin <[email protected]> | ||
# Created: 2015-12-05 | ||
set -euo pipefail | ||
pids=(--) | ||
|
||
: ${DEEPDIVE_NUM_PROCESSES:=$(nproc --ignore=1)} | ||
|
||
# a handy barrier to not spawn too many codegen processes | ||
num_active=0 | ||
wait_if_needed() { | ||
local pid=$! | ||
if [[ $num_active -ge $DEEPDIVE_NUM_PROCESSES ]]; then | ||
wait -n | ||
let num_active-- | ||
fi | ||
let ++num_active | ||
} | ||
wait_all() { | ||
while [[ $num_active -gt 0 ]]; do | ||
wait -n | ||
let num_active-- | ||
done | ||
} | ||
|
||
# translate codegen instructions in JSON into commands and run them in parallel | ||
eval "$(jq -r ' | ||
@sh " | ||
( | ||
( @sh " | ||
{ | ||
x=\(.path) | ||
echo >&2 \" run/$x\" | ||
echo >&2 \" run/$x (PID $BASHPID)\" | ||
# ensure parent dir exists | ||
xd=\"$(dirname \"$x\")\" | ||
mkdir -p \"$xd\" | ||
|
@@ -18,19 +38,32 @@ eval "$(jq -r ' | |
chmod +w \"$x\" \"$xd\" || true | ||
mv -f --no-target-directory \"$x\" \"$x\"~ | ||
fi | ||
# write contents | ||
echo \(.content) >\"$x\" | ||
" | ||
+ (.content | | ||
def find_no_occurs(eof; repeat): | ||
if contains(eof * repeat) | not then eof * repeat | ||
else find_no_occurs(eof; repeat+1) | ||
end; | ||
"\(find_no_occurs("__EOF"; 1))__" as $EOF | " | ||
# write contents | ||
cat >\"$x\" <<'\''\($EOF)'\'' | ||
\(.) | ||
\($EOF) | ||
") | ||
+ (.mode | if . then @sh " | ||
# adjust mode | ||
chmod \(.) \"$x\"" | ||
else "" | ||
end) | ||
# finally, make sure each codegen runs asynchronously | ||
+ @sh " | ||
) & pids+=($!) # run each codegen asynchronously | ||
} & wait_if_needed | ||
" | ||
) | ||
')" | ||
waitall() { shift; local pid=; for pid; do wait $pid; done; } | ||
waitall "${pids[@]}" # ensure every process exits with zero status | ||
|
||
# wait for all asynchronous processes to finish | ||
wait_all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule buildkit
updated
4 files
+8 −0 | depends/common/graphviz-devel/install.sh | |
+3 −3 | enumerate-shared-libraries-required-by | |
+1 −1 | most-recently-modified-files | |
+1 −1 | watch-filesystem-events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,7 @@ moreutils | |
graphviz | ||
bc | ||
pbzip2 | ||
python-virtualenv | ||
postgresql | ||
python-lib | ||
perl-local-lib | ||
|
||
postgresql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# NOTE this list is kept empty to bundle none of the runtime dependencies | ||
python-virtualenv | ||
python-lib | ||
perl-local-lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail -x | ||
|
||
unset PYTHONPATH # existing PYTHONPATH can interfere | ||
|
||
# install Python requirements with pip | ||
fetch-verify get-pip.py https://bootstrap.pypa.io/get-pip.py | ||
for python in python2.7 python3.{6,5,4}; do | ||
type $python || continue | ||
( export PYTHONPATH="$PWD"/prefix/lib/$python/site-packages | ||
$python get-pip.py --upgrade --force-reinstall --ignore-installed --prefix prefix setuptools | ||
$python get-pip.py --upgrade --force-reinstall --ignore-installed --prefix prefix -r requirements.txt | ||
) | ||
done | ||
|
||
# remove pip and setuptools | ||
shopt -s extglob | ||
rm -rf prefix/bin/@(pip@(|[23]*)|wheel) prefix/lib/python*/site-packages/@(pip|setuptools|easy_install)@(|-*) | ||
|
||
# make sure no entrypoints have absolute path to python in its shebang | ||
for cmd in prefix/bin/*; do | ||
head -1 "$cmd" | grep -q '^#!/[^[:space:]]*/python.*$' || continue | ||
sed -e '1s:^#!/[^[:space:]]*/python.*$:#!/usr/bin/env python:' -i~ "$cmd" | ||
rm -f "$cmd"~ | ||
done | ||
|
||
# make sure things are properly exposed | ||
symlink-under-depends-prefix lib -d prefix/lib/python* | ||
symlink-under-depends-prefix bin -x prefix/bin/!(activate@(|.*|_this.py)|python@(|[23]*|-config)|pip@(|[23]*)|easy_install@(|-[23]*)|wheel) |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.