-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
63 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
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,16 +1,8 @@ | ||
HAS_NIX := $(shell which nix-shell || echo y) | ||
|
||
DEPLOY_PYTHON := $(CURDIR)/deploy.sh | ||
|
||
.PHONY: deploy | ||
|
||
ifneq ($(HAS_NIX),) | ||
DEPLOY_COMMAND := nix-shell ../default.nix --pure --run "PYPI_USERNAME=$(PYPI_USERNAME) PYPI_PASSWORD=$(PYPI_PASSWORD) SBP_VERSION=$(SBP_VERSION) $(DEPLOY_PYTHON)" | ||
else | ||
DEPLOY_PYTHON := $(CURDIR)/deploy.bash | ||
DEPLOY_COMMAND := SBP_VERSION=$(SBP_VERSION) $(SHELL) $(DEPLOY_PYTHON) | ||
endif | ||
|
||
deploy: | ||
@[ -n "$(PYPI_USERNAME)" ] || { echo "\n!!! Please set PYPI_USERNAME in the environment !!!\n"; exit 1; } | ||
@[ -n "$(PYPI_PASSWORD)" ] || { echo "\n!!! Please set PYPI_PASSWORD in the environment !!!\n"; exit 1; } | ||
$(DEPLOY_COMMAND) |
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,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
[[ -n "$PYPI_USERNAME" ]] || \ | ||
{ printf "\n!!! Please set PYPI_USERNAME in the environment !!!\n\n"; exit 1; } | ||
|
||
[[ -n "$PYPI_PASSWORD" ]] || \ | ||
{ printf "\n!!! Please set PYPI_PASSWORD in the environment !!!\n\n"; exit 1; } | ||
|
||
if ! command -v conda; then | ||
echo '!!! Please install conda to deploy python !!!' | ||
fi | ||
|
||
conda_dir=$(mktemp -d) | ||
conda create --yes -p "$conda_dir" python=3.5 | ||
|
||
# Activate conda | ||
{ | ||
# Workaround bug in activate code... | ||
export PS1='' | ||
|
||
eval "$(conda shell.bash hook)" | ||
# shellcheck disable=SC1091 | ||
source activate "$conda_dir" | ||
} | ||
|
||
conda install --yes \ | ||
cython virtualenv twine wheel | ||
|
||
deploy_dir=$(mktemp -d) | ||
trap 'rm -rf "$deploy_dir" "$conda_dir"' EXIT | ||
|
||
echo "$deploy_dir" | ||
cd "$deploy_dir" | ||
|
||
echo ">>> Building staging area for deployment ..." | ||
|
||
mkdir module | ||
|
||
cp -r "$(dirname "$0")"/../.git . | ||
|
||
cp -r "$(dirname "$0")"/.coveragerc module/. | ||
cp -r "$(dirname "$0")"/.gitignore module/. | ||
|
||
cp -r "$(dirname "$0")"/* module/. | ||
|
||
echo ">>> Pruning ..." | ||
rm -r -f module/docs/_build | ||
rm -r -f module/build/* | ||
|
||
echo ">>> Patching setup.py ..." | ||
sed -i.backup 's@IS_RELEASED = False@IS_RELEASED = True@' module/setup.py | ||
|
||
cd module | ||
|
||
echo ">>> Building Python wheel ..." | ||
python setup.py sdist bdist_wheel | ||
|
||
echo ">>> Uploading Python wheel ..." | ||
twine upload -u "$PYPI_USERNAME" -p "$PYPI_PASSWORD" "dist/sbp-$SBP_VERSION-*.whl" |
This file was deleted.
Oops, something went wrong.