mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
Pyinstaller launcher and dependency updates
This PR adds a new launcher executable to the unpack feature, eliminating the need to have python and its dependencies in the unpacked version. It also does a few dependency changes to help future proof.
This commit is contained in:
parent
8386546e08
commit
f151648f03
13 changed files with 41 additions and 16 deletions
32
koboldcpp.py
32
koboldcpp.py
|
@ -654,6 +654,9 @@ def unpack_to_dir(destpath = ""):
|
|||
if not destpath:
|
||||
return
|
||||
|
||||
if not os.path.isdir(destpath):
|
||||
os.makedirs(destpath)
|
||||
|
||||
if os.path.isdir(srcpath) and os.path.isdir(destpath) and not os.listdir(destpath):
|
||||
try:
|
||||
if cliunpack:
|
||||
|
@ -661,18 +664,35 @@ def unpack_to_dir(destpath = ""):
|
|||
else:
|
||||
messagebox.showinfo("Unpack Starting", f"KoboldCpp will be extracted to {destpath}\nThis process may take several seconds to complete.")
|
||||
pyds_dir = os.path.join(destpath, 'pyds')
|
||||
using_pyinstaller_6 = False
|
||||
try:
|
||||
import pkg_resources
|
||||
piver = pkg_resources.get_distribution("pyinstaller").version
|
||||
print(f"PyInstaller Version: {piver}")
|
||||
if piver.startswith("6."):
|
||||
using_pyinstaller_6 = True
|
||||
os.makedirs(os.path.join(destpath, "_internal"), exist_ok=True)
|
||||
pyds_dir = os.path.join(os.path.join(destpath, "_internal"), 'pyds')
|
||||
except Exception:
|
||||
pass
|
||||
os.makedirs(pyds_dir, exist_ok=True)
|
||||
for item in os.listdir(srcpath):
|
||||
s = os.path.join(srcpath, item)
|
||||
d = os.path.join(destpath, item)
|
||||
if item.endswith('.pyd'): # relocate pyds files to subdirectory
|
||||
d = os.path.join(pyds_dir, item)
|
||||
d2 = d #this will be modified for pyinstaller 6 and unmodified for pyinstaller 5
|
||||
if using_pyinstaller_6:
|
||||
d2 = os.path.join(os.path.join(destpath, "_internal"), item)
|
||||
if using_pyinstaller_6 and item.startswith('koboldcpp-launcher'): # Move koboldcpp-launcher to its intended location
|
||||
shutil.copy2(s, d)
|
||||
continue
|
||||
if item.endswith('.pyd'): # relocate pyds files to subdirectory
|
||||
pyd = os.path.join(pyds_dir, item)
|
||||
shutil.copy2(s, pyd)
|
||||
continue
|
||||
if os.path.isdir(s):
|
||||
shutil.copytree(s, d2, False, None)
|
||||
else:
|
||||
if os.path.isdir(s):
|
||||
shutil.copytree(s, d, False, None)
|
||||
else:
|
||||
shutil.copy2(s, d)
|
||||
shutil.copy2(s, d2)
|
||||
if cliunpack:
|
||||
print(f"KoboldCpp successfully extracted to {destpath}")
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue