From ab6bb60853a0086b2f3a122d314ca3a3385a560f Mon Sep 17 00:00:00 2001 From: Travis V Date: Sat, 21 Dec 2024 03:44:59 -0500 Subject: [PATCH] Needed to update the build.yml ugh. Attempt no1 --- .github/workflows/build.yml | 63 ++++++++++++++++++++----------------- cli_tool_gptree/main.py | 2 +- setup.py | 2 +- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3affc7d..65c63b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/cli_tool_gptree/main.py b/cli_tool_gptree/main.py index 54bf2ae..679d505 100644 --- a/cli_tool_gptree/main.py +++ b/cli_tool_gptree/main.py @@ -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 diff --git a/setup.py b/setup.py index f9621ce..7300b1b 100644 --- a/setup.py +++ b/setup.py @@ -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",