pyghidra-mcp: WiP

This commit is contained in:
Anton Bolshakov 2025-08-24 11:34:10 +08:00
parent d30a4a0522
commit 45c765a415
No known key found for this signature in database
GPG key ID: 32BDCED870788F04
6 changed files with 142 additions and 12 deletions

View file

@ -0,0 +1 @@
DIST chromadb-1.0.20.tar.gz 1244999 BLAKE2B 3a9f99153f77679d444d107d3f04f3ebfaf30b2e04935fc6a34e1fcf013ce796450a715487b22c4091e764ef313b80a517c7d76ec93a88b4bb395d9d63f3c8ef SHA512 a093bbcaeb7fc0bd4bb02bfb8a8efab100107faa57b3ae8fdf95b4e2ed5107470df629be9bc522b8ed26627eefacf22585f4aae7673b7a40da5d5c45b3dab4a2

View file

@ -0,0 +1,51 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=maturin
PYTHON_COMPAT=( python3_{11..13} )
inherit distutils-r1 pypi
DESCRIPTION="Embedding database for LLM apps"
HOMEPAGE="https://pypi.org/project/chromadb/"
LICENSE="Apache-2.0"
SLOT="0"
#KEYWORDS="~amd64 ~arm64 ~x86"
# >=dev-python/build-1.0.3[${PYTHON_USEDEP}]
# FIXME: WiP, add missing deps
RDEPEND="
>=dev-python/pydantic-1.9[${PYTHON_USEDEP}]
>=dev-python/pybase64-1.4.1[${PYTHON_USEDEP}]
>=dev-python/uvicorn-0.18.3[standard,${PYTHON_USEDEP}]
>=dev-python/numpy-1.22.5[${PYTHON_USEDEP}]
>=dev-python/posthog-2.4.0[${PYTHON_USEDEP}]
>=dev-python/typing_extensions-4.5.0[${PYTHON_USEDEP}]
>=dev-python/onnxruntime-1.14.1[${PYTHON_USEDEP}]
>=dev-python/opentelemetry-api-1.2.0[${PYTHON_USEDEP}]
>=dev-python/opentelemetry-exporter-otlp-proto-grpc-1.2.0[${PYTHON_USEDEP}]
>=dev-python/opentelemetry-sdk-1.2.0[${PYTHON_USEDEP}]
>=dev-python/tokenizers-0.13.2[${PYTHON_USEDEP}]
>=dev-python/pypika-0.48.9[${PYTHON_USEDEP}]
>=dev-python/tqdm-4.65.0[${PYTHON_USEDEP}]
>=dev-python/overrides-7.3.1[${PYTHON_USEDEP}]
>=dev-python/grpcio-1.58.0[${PYTHON_USEDEP}]
>=dev-python/bcrypt-4.0.1[${PYTHON_USEDEP}]
>=dev-python/typer-0.9.0[${PYTHON_USEDEP}]
>=dev-python/kubernetes-28.1.0[${PYTHON_USEDEP}]
>=dev-python/tenacity-8.2.3[${PYTHON_USEDEP}]
>=dev-python/pyyaml-6.0.0[${PYTHON_USEDEP}]
>=dev-python/mmh3-4.0.1[${PYTHON_USEDEP}]
>=dev-python/orjson-3.9.12[${PYTHON_USEDEP}]
>=dev-python/httpx-0.27.0[${PYTHON_USEDEP}]
>=dev-python/rich-10.11.0[${PYTHON_USEDEP}]
>=dev-python/jsonschema-4.19.0[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RESTRICT="test"
#distutils_enable_tests pytest

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>unknown@pentoo.ch</email>
<name>Author Unknown</name>
</maintainer>
<upstream>
</upstream>
</pkgmetadata>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>unknown@pentoo.ch</email>
<name>Author Unknown</name>
</maintainer>
<upstream>
</upstream>
</pkgmetadata>

View file

@ -0,0 +1,29 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{11..13} )
inherit distutils-r1 pypi
DESCRIPTION="Python Command-Line Ghidra MCP"
HOMEPAGE="https://pypi.org/project/pyghidra-mcp/"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
#RDEPEND=""
DEPEND="${RDEPEND}
>=dev-python/click-8.2.1[${PYTHON_USEDEP}]
>=dev-python/mcp-1.9.4[cli,${PYTHON_USEDEP}]
>=dev-python/pyghidra-2.1.0[${PYTHON_USEDEP}]
>=dev-python/chromadb-0.5.5[${PYTHON_USEDEP}]
"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RESTRICT="test"
#distutils_enable_tests pytest

View file

@ -10,6 +10,10 @@ import re
import os
import tomli
#from packaging.requirements import InvalidRequirement, Requirement
#import packaging.specifiers
#from packaging.version import Version
__author__ = "Anton Bolshakov"
__license__ = "GPL-3"
__email__ = "blshkv@pentoo.ch"
@ -95,20 +99,41 @@ def portage_mapping(replace_string):
return result
def pyproject_toml():
try:
with open('./pyproject.toml', 'rb') as f:
try:
print("pyproject.toml found")
# FIXME: support this:
#dependencies = tomli.load(f)['project']['dependencies']
dependencies = tomli.load(f)['tool']['poetry']['dependencies']
parsed_toml = tomli.load(f)
if "project" in parsed_toml:
# Example:
# [project]
# dependencies = [ "build >= 1.0.3", "pydantic >= 1.9" ]
dependencies_list = parsed_toml["project"]["dependencies"]
i = iter(dependencies_list)
dependencies=dict.fromkeys(i, "*")
#for i, entry in enumerate(dependencies_list, 1):
# if not isinstance(entry, str):
# raise TypeError(f'Dependency #{i} of field `project.dependencies` must be a string')
# try:
# req = Requirement(entry)
# print(f"[DEBUG] specifier {req.specifier}")
# # it would be set or specifier
# spec = SpecifierSet(req.specifier)
# spec = Specifier(req.specifier)
#print(f"[DEBUG] requirements {req.name}")
# except InvalidRequirement as e:
# raise ValueError(f'Dependency #{i} of field `project.dependencies` is invalid: {e}')
elif "tool" in parsed_toml:
# Example:
# [tool.poetry.dependencies]
# requests = "^2.13.0"
dependencies = parsed_toml['tool']['poetry']['dependencies']
except:
try:
# FIXME: add support pyproject dependencies = [], see fastapi as an example
# Dependency specification in pyproject.toml
# https://peps.python.org/pep-0631/
# https://stackoverflow.com/questions/49689880/proper-way-to-parse-requirements-file-after-pip-upgrade-to-pip-10-x-x
# FIXME: use https://pypi.org/project/requirements-parser
# or pkg_resources.parse_requirements(value)
@ -128,12 +153,12 @@ def pyproject_toml():
except:
# FIXME:
# build-backend = "setuptools.build_meta"
print("Unable to find 'poetry' dependencies, trying setuptools instead")
print("Unable to find pyproject dependencies, trying setuptools instead")
return 1
except FileNotFoundError:
return 1
#Debug
print("DEBUG: the following deps found:", dependencies) # List of static requirements
# print("DEBUG: the following deps found:", dependencies) # List of static requirements
for key, value in dependencies.items():
if key == "python":
continue
@ -185,8 +210,10 @@ def distutils_setup():
print("\"")
def main():
if pyproject_toml():
distutils_setup()
pyproject_toml()
#if pyproject_toml():
# distutils_setup()
if __name__ == '__main__':
main()