Skip to content

Commit

Permalink
Package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dnakov committed Jun 7, 2024
1 parent 2e906ae commit 88f2a95
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 59 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
venv
35 changes: 20 additions & 15 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
import sys
import os

if "R2AI" in os.environ:
print("Cant load r2ai r2 plugin from inside r2ai")
sys.exit(0)
r2aihome = os.path.dirname(__file__)
try:
r2aihome = os.path.dirname(os.readlink(__file__))
except (OSError, FileNotFoundError):
pass
sys.path.insert(0, r2aihome)
os.environ["R2AI"] = "1"
if "VIRTUAL_ENV" in os.environ or "R2CORE" in os.environ:
runpy.run_path(os.path.join(r2aihome, 'r2ai', 'main.py'))
else:
ARGS = " ".join(sys.argv[1:])
os.system(f"cd {r2aihome}; ./r2ai.sh {ARGS}")
def main():
print('os', os.environ.get('R2AI'))
if os.environ.get('R2AI'):
print("Cant load r2ai r2 plugin from inside r2ai")
sys.exit(0)
r2aihome = os.path.dirname(__file__)
try:
r2aihome = os.path.dirname(os.readlink(__file__))
except (OSError, FileNotFoundError):
pass
sys.path.insert(0, r2aihome)
os.environ["R2AI"] = "1"
if "VIRTUAL_ENV" in os.environ or "R2CORE" in os.environ:
runpy.run_path(os.path.join(r2aihome, 'r2ai', 'main.py'))
else:
ARGS = " ".join(sys.argv[1:])
os.system(f"cd {r2aihome}; ./r2ai.sh {ARGS}")

if(__name__ == "__main__"):
main()
52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[project]
name = "r2ai"
dynamic = ["readme"]
version = "0.7.0"
description = "Applying language models on radare2 for reverse engineering and fun purposes"

license = {text = "MIT License"}
authors = [
{name = "pancake", email = "[email protected]"}
]

[project.urls]
homepage = "https://www.radare.org/"
repository = "https://github.com/radareorg/r2ai"

[project.scripts]
r2ai = "r2ai:main"

[tool.setuptools.packages.find]
where = [".", "r2ai"]
include = ["main", "r2ai"]
namespaces = true

[tool.setuptools.dynamic]
readme = {file = "README.md", content-type = "text/markdown"}

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

dependencies = [
"rich",
"r2pipe",
"inquirer",
"llama-cpp-python",
"huggingface_hub==0.22.0",
"appdirs",
"unidecode",
"jsonref",
"transformers",
"pydantic",
"torch"
]

[project.optional-dependencies]
extras = [
"openai",
"anthropic",
"groq",
"google-generativeai",
"google-cloud-aiplatform"
]
5 changes: 0 additions & 5 deletions r2ai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
import sys
from .models import models, mainmodels
sys.modules["r2ai"].models = models
sys.modules["r2ai"].mainmodels = mainmodels
VERSION = "0.7.0"
39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

0 comments on commit 88f2a95

Please sign in to comment.