Compare commits

...
6 Commits
Author SHA1 Message Date
pancake 26919c415a More pypi massaging 2021-06-17 19:25:40 +02:00
pancake e9e08436cb Fix make pub and sync version (#13) 2021-06-17 19:08:14 +02:00
pancake 3613127925 Fix more command parsing issues (#12) 2021-06-17 19:05:00 +02:00
pancake 3c0dd5a10e Fix 'r2 shell -v' (#9) 2021-06-17 18:13:02 +02:00
pancake a455d306b4 Fix build and shell for termux (#8) 2021-06-17 18:12:47 +02:00
pancake 7513c6d1b6 Implement r2env shell for unix (#4) 2021-06-17 01:07:30 +02:00
5 changed files with 43 additions and 16 deletions

No files matched your search

+4
View File
@@ -4,7 +4,11 @@ all:
pip install .
pub:
rm -rf dist
$(PYTHON) setup.py sdist
$(PYTHON) setup.py build
twine upload --repository-url https://upload.pypi.org/legacy/ --verbose dist/*
#twine upload --repository=r2env --verbose dist/*
install:
pip install .
+10 -3
View File
@@ -87,11 +87,18 @@ class R2Env:
@staticmethod
def version():
with open("version.txt", "r") as version:
thispath = os.path.dirname(os.path.realpath(__file__))
with open(thispath + "/version.txt", "r") as version:
return version.read()
def shell(self):
pass
def shell(self, cmd=""):
line = "export PS1=\"r2env\\$ \";export PATH=\"" + self._r2env_path + "/bin:$PATH\"; $SHELL -f"
if os.path.isfile("/default.prop"): # hack for pre-dtag builds of r2
line = "export LD_LIBRARY_PATH=\"" + self._r2env_path + "/lib\";" + line
if cmd.strip() == "":
return os.system(line)
print(os.system(line + " -c '" + cmd + "'"))
return os.system(line + " -c '" + cmd + "'")
@staticmethod
def _load_config():
+7 -3
View File
@@ -94,9 +94,13 @@ class PackageManager:
def _build_using_acr(source_path, dst_path, logfile):
"""Only works in Unix systems"""
exit_if_not_exists(['make'])
print_console("[-] Building package using acr ...")
cmd = "(cd {0} && rm -rf shlr/capstone && ./configure --with-rpath --prefix={1} 2>&1 && make -j4 2>&1" \
"&& make install) > {2}".format(source_path, dst_path, logfile)
print_console("[-] Building package using acr for Termux...")
extra_flags = ""
if os.path.isfile("/default.prop"):
extra_flags = " --with-compiler=termux"
cmd = "(cd {0} && rm -rf shlr/capstone && ./configure {1}" \
" --with-rpath --prefix={2} 2>&1 && make -j4 2>&1" \
"&& make install) > {3}".format(source_path, extra_flags, dst_path, logfile)
return os.system(cmd) == 0
@staticmethod
+18 -7
View File
@@ -16,7 +16,8 @@ config - display current .r2env settings
install [pkg] - build and install given package. Use --meson to use it as the build system.
uninstall [pkg] - remove selected package
use [pkg] - use r2 package defined. pkg should be a release version or latest.
version - show the current Radare version and its origin
path - show path of current r2 in use
version - show version of r2env
versions - List all Radare versions installed
list - list all Radare packages available to r2env
shell - open a new shell with PATH env var set
@@ -28,13 +29,20 @@ def show_help():
print_console(HELP_MESSAGE)
def show_version():
print_console(R2Env().version())
actions_with_argument = ["install", "uninstall", "use"]
actions_with_arguments = ["shell"]
actions = {
"init": R2Env().init,
"version": R2Env().get_r2_path,
"version": show_version,
"path": R2Env().get_r2_path,
"config": R2Env().show_config,
"list": R2Env().list_available_packages,
"install": R2Env().install,
"shell": R2Env().shell,
"uninstall": R2Env().uninstall,
"use": R2Env().use,
"versions": R2Env().list_installed_packages,
@@ -43,10 +51,13 @@ actions = {
def run_action(action, args, use_meson):
if action not in actions:
if action == "":
show_help()
elif action not in actions:
print_console("[X] Action not found", ERROR)
return
if action in actions_with_argument:
elif action in actions_with_arguments:
actions[action](" ".join(args))
elif action in actions_with_argument:
exit_if_not_argument_is_set(args, action)
if action == "install":
actions[action](args[0], use_meson=use_meson)
@@ -72,8 +83,8 @@ def main():
parser.add_argument("action", help="run specified action. (Run r2env help for more information)",
action="store", default=["help"])
parser.add_argument('args', metavar='args', nargs='*', type=str, help='Specified arguments')
parser.add_argument("-v", "--version", help="Show r2env version", action="store_true")
parser.add_argument("-m", "--meson", help="Use meson as your build system.", action="store_true")
parser.add_argument("-v", "--version", dest="version", help="Show r2env version", action="store_true")
parser.add_argument("-m", "--meson", dest="meson", help="Use meson as your build system.", action="store_true")
args = parser.parse_args()
if args.version:
print_console(R2Env().version())
+4 -3
View File
@@ -1,9 +1,10 @@
[metadata]
license_file = LICENSE
version = 0.2.2
version = 0.3.0
name = r2env
author = 'pancake, murphy'
author_email = '[email protected], [email protected]'
author = pancake
# author_email = '[email protected], [email protected]'
author_email = [email protected]
description = radare2 multiple version and environment installation tool
long_description = file:README.md
url = https://www.radare.org/