Skip to content

Commit

Permalink
Needed to update the build.yml ugh. Attempt no1
Browse files Browse the repository at this point in the history
  • Loading branch information
travisvn committed Dec 21, 2024
1 parent e2a1ee3 commit ab6bb60
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
63 changes: 34 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,43 +138,48 @@ jobs:
license "MIT"
version "${VERSION}"
depends_on "python@3.9" => :optional
depends_on "python" => :optional
on_macos do
url "${MACOS_URL}"
sha256 "${MACOS_SHA}"
end
on_linux do
url "${LINUX_URL}"
sha256 "${LINUX_SHA}"
end
resource "pyperclip" do
url "https://files.pythonhosted.org/packages/source/p/pyperclip/pyperclip-1.9.0.tar.gz"
sha256 "b7de0142ddc81bfc5c7507eea19da920b92252b548b96186caf94a5e2527d310"
end
resource "pathspec" do
url "https://files.pythonhosted.org/packages/source/p/pathspec/pathspec-0.12.1.tar.gz"
sha256 "a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"
end
def install
if system("which pip3")
# Attempt to install via pip
pip_success = system("pip3", "install", "gptree-cli==${VERSION}", "--prefix=#{prefix}")
unless pip_success
opoo "pip3 installation failed. Falling back to binary installation."
download_and_install_binary
end
# Find python3 and pip3 in the user's PATH
python_path = `which python3`.chomp
pip_path = `which pip3`.chomp
if !python_path.empty? && !pip_path.empty? && system("#{python_path}", "--version") && system("#{pip_path}", "--version")
opoo "Python and pip detected. Installing with pip."
ENV.prepend_path "PATH", File.dirname(python_path) # Ensure the detected Python is prioritized
virtualenv_install_with_resources
else
# Fallback to binary installation if pip3 isn't available
download_and_install_binary
opoo "Python or pip not detected. Falling back to binary installation."
install_binary
end
end
def download_and_install_binary
def install_binary
if OS.mac?
url = "${MACOS_URL}"
sha256 = "${MACOS_SHA}"
fetch_and_install(url, sha256, "gptree-macos")
bin.install "gptree-macos" => "gptree"
elsif OS.linux?
url = "${LINUX_URL}"
sha256 = "${LINUX_SHA}"
fetch_and_install(url, sha256, "gptree-ubuntu")
end
end
def fetch_and_install(url, sha256, filename)
# Download the file manually
resource filename do
url url
sha256 sha256
end
resource(filename).stage do
bin.install filename => "gptree"
bin.install "gptree-ubuntu" => "gptree"
end
end
Expand Down
2 changes: 1 addition & 1 deletion cli_tool_gptree/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pyperclip
import copy

CURRENT_VERSION = 'v1.1.2'
CURRENT_VERSION = 'v1.1.3'

SAFE_MODE_MAX_FILES = 30
SAFE_MODE_MAX_LENGTH = 100_000 # ~25K tokens, reasonable for most LLMs
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="gptree-cli",
version="1.1.2",
version="1.1.3",
author="Travis Van Nimwegen",
author_email="cli@travisvn.com",
description="A CLI tool to provide LLM context for coding projects by combining project files into a single text file (or clipboard text) with directory tree structure",
Expand Down

0 comments on commit ab6bb60

Please sign in to comment.