Skip to content

Commit d2f2392

Browse files
bug: don't match archive with glob
In the current directory is the archive (gptscript...tar.gz) and the binary (gptscript or gptscript.exe). The current approach will sometimes match the archive. By removing '*' it will look for the exact filename.
1 parent 97a47fa commit d2f2392

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

gptscript/install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def install():
150150

151151
# Find the extracted binary and rename/move it to the versioned name in the python bin directory
152152
extracted_binary_path = next(
153-
output_dir.glob(gptscript_binary_name + "*"), None
153+
output_dir.glob(gptscript_binary_name), None
154154
) # Adjust the glob pattern if necessary
155155
if extracted_binary_path:
156156
shutil.move(str(extracted_binary_path), str(versioned_binary_path))

tests/test_gptscript.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import os
22
import platform
3+
import subprocess
34

45
import pytest
56

67
from gptscript.confirm import AuthResponse
78
from gptscript.frame import RunEventType, CallFrame, RunFrame, RunState, PromptFrame
89
from gptscript.gptscript import GPTScript
10+
from gptscript.install import install, gptscript_binary_name, python_bin_dir
911
from gptscript.opts import GlobalOptions, Options
1012
from gptscript.prompt import PromptResponse
1113
from gptscript.run import Run
@@ -77,6 +79,13 @@ def tool_list():
7779
]
7880

7981

82+
def test_install():
83+
install()
84+
bin_name = str(python_bin_dir / gptscript_binary_name)
85+
process = subprocess.Popen([bin_name, '-v'], stdout=subprocess.PIPE, text=True)
86+
assert process.stdout.read().startswith('gptscript version ')
87+
88+
8089
@pytest.mark.asyncio
8190
async def test_create_another_gptscript():
8291
g = GPTScript()
@@ -427,8 +436,8 @@ async def process_event(r: Run, frame: CallFrame | RunFrame | PromptFrame):
427436
).text()
428437

429438
assert confirm_event_found, "No confirm event"
430-
assert "authorization error" in out, "Unexpected output: " + out
431-
assert "authorization error" in event_content, "Unexpected event output: " + event_content
439+
assert "unable to list" in out, "Unexpected output: " + out
440+
assert "unable to list" in event_content, "Unexpected event output: " + event_content
432441

433442

434443
@pytest.mark.asyncio

0 commit comments

Comments
 (0)