Skip to content

Commit

Permalink
feat: create install script
Browse files Browse the repository at this point in the history
  • Loading branch information
hhamud committed Jul 30, 2023
1 parent c70f80f commit bf3aaa3
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Install

on:
push:
branches:
- main
pull_request:
branches:
- "**"

jobs:
install:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Run the install script
run: |
curl -sSL "https://raw.githubusercontent.com/hhamud/dasy/main/scripts/install.sh" | bash
6 changes: 6 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Learn more in the [[file:docs.org][documentation]]
#+end_src

* Installation

** Using a Bash script (Only MacOS and Linux)
#+begin_src bash
curl -sSL "https://raw.githubusercontent.com/hhamud/dasy/main/install.sh" | bash
#+end_src

** For use as a library
#+begin_src bash
pip install git+https://github.com/dasylang/dasy.git
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ vyper = "^0.3.9"
eth-abi = "^4.0.0"
eth-typing = "^3.2.0"
py-evm = ">=0.6.1a2"
eth-ape = "^0.6.15"

[tool.poetry.dev-dependencies]
pytest = ">=7.1"
Expand Down
10 changes: 10 additions & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ape stuff
.build/
.cache/

# Python
.env
.venv
.pytest_cache
.python-version
__pycache__
63 changes: 63 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash


set -e

# Constants
PYTHON_VERSION="3.10" # Use Python v3.10

# Function to check if a command exists
command_exists() {
command -v "$1" &>/dev/null
}

# Function to install Python v3.11 if not already installed
install_python() {
if ! command_exists python$PYTHON_VERSION; then
echo "Python is not installed. Installing Python v$PYTHON_VERSION..."
if [[ "$(uname)" == "Linux" ]]; then
sudo apt-get update
sudo apt-get install -y python$PYTHON_VERSION
elif [[ "$(uname)" == "Darwin" ]]; then
# Install Python using Homebrew
brew install python@$PYTHON_VERSION
export PATH="/usr/local/opt/python@$PYTHON_VERSION/bin:$PATH"
else
echo "The shell script is not suitable for Windows."
exit 1
fi
else
echo "Python is already installed."
fi
}

# Function to install eth-ape using Poetry
install_eth_ape() {
echo "Installing eth-ape..."
python$PYTHON_VERSION -m pip install --upgrade pip
pip install --user eth-ape
}

# Function to install APE-Dasy using Poetry
install_ape_dasy() {
echo "Installing APE-Dasy..."
python$PYTHON_VERSION -m pip install --upgrade pip
pip install --user ape-dasy
}

# Main script
main() {
# Install Python v3.11 (if not already installed)
install_python

# Install eth-ape using Poetry
install_eth_ape

# Install APE-Dasy using Poetry
install_ape_dasy

echo "Setup complete. eth-ape and APE-Dasy have been installed."
}

# Run the main script
main

0 comments on commit bf3aaa3

Please # to comment.