Install circle CLI in setup.py develop

pull/1931/head
Kieran Prasch 2020-04-24 18:57:16 -07:00 committed by Kieran R. Prasch
parent 04063cfdb2
commit ec4d617a54
2 changed files with 61 additions and 2 deletions

58
.circleci/install_circle_cli.sh Executable file
View File

@ -0,0 +1,58 @@
#!/usr/bin/env bash
# Install the CircleCI CLI tool.
# https://github.com/CircleCI-Public/circleci-cli
#
# Dependencies: curl, cut
#
# The version to install and the binary location can be passed in via VERSION and DESTDIR respectively.
#
set -o errexit
echo "Starting installation."
# GitHub's URL for the latest release, will redirect.
LATEST_URL="https://github.com/CircleCI-Public/circleci-cli/releases/latest/"
DESTDIR="${DESTDIR:-/usr/local/bin}"
if [ -z "$VERSION" ]; then
VERSION=$(curl -sLI -o /dev/null -w '%{url_effective}' $LATEST_URL | cut -d "v" -f 2)
fi
echo "Installing CircleCI CLI v${VERSION}"
# Run the script in a temporary directory that we know is empty.
SCRATCH=$(mktemp -d || mktemp -d -t 'tmp')
cd "$SCRATCH"
function error {
echo "An error occured installing the tool."
echo "The contents of the directory $SCRATCH have been left in place to help to debug the issue."
}
trap error ERR
# Determine release filename. This can be expanded with CPU arch in the future.
if [ "$(uname)" == "Linux" ]; then
OS="linux"
elif [ "$(uname)" == "Darwin" ]; then
OS="darwin"
else
echo "This operating system is not supported."
exit 1
fi
RELEASE_URL="https://github.com/CircleCI-Public/circleci-cli/releases/download/v${VERSION}/circleci-cli_${VERSION}_${OS}_amd64.tar.gz"
# Download & unpack the release tarball.
curl -sL --retry 3 "${RELEASE_URL}" | tar zx --strip 1
echo "Installing to $DESTDIR"
mv circleci "$DESTDIR"
chmod +x "$DESTDIR/circleci"
command -v circleci
# Delete the working directory when the install was successful.
rm -r "$SCRATCH"

View File

@ -20,6 +20,7 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
"""
import os
import subprocess
import sys
from setuptools import setup, find_packages
@ -86,14 +87,14 @@ class PostDevelopCommand(develop):
"""
def run(self):
develop.run(self)
print("Downloading solidity compiler binary")
download_solc_binary()
subprocess.call(".circleci/install_circle_cli.sh")
#
# Dependencies
#
def read_requirements(path):
with open(os.path.join(BASE_DIR, path)) as f:
_PIPENV_FLAGS, *REQUIREMENTS = f.read().split('\n')